General
The simple backup script expects to be called with two parameters. The first being the file which contains the list of directories to backup, the second the file which contains the expressions for excluding files.
So basically the command line for the backupscript is something like:
backup.sh dir_list excludelist
The script will output it’s progress to standard output.
Configuration
The script itself contains a few variables which can be modified. In case you’re using a newer or older version of tar you almost certain need to change one of the variables.
The following variables are being used:
- TMPPATH
Where to write temporary files.
default: /tmp - BACKUPPATH
Which path to use to write the final archives to
default: /tmp - TARCOMPRESSION (new in 1.1)
The flag to use for compression the tar archive (-j for bzip2 compression with old versions of tar -y for new versions)
default: -y - POSTDIR (new in 1.1)
The directory which contains the scripts to run after the backup has been made (post operations)
default: /post/ - PREDIR (new in 1.1)
The directory which contains the scripts to run before starting to backup (pre operations)
default: /pre/
Output
The script will output all progress towards standard output. The output will be formatted to provide a bit better readability.
= Initializing = + Started at: 24-12-07 00:40:01 + Reading backuplist from /root/scripts/backupdirs + Reading excludelist from /root/scripts/excludelist + Building dir array = Gathering files = + Creating randomfile + Gathering /home/ into /tmp/119845320126532 + Creating randomfile + Gathering /etc/ into /tmp/119845323218701 = Removing unwanted files = + Grepping /tmp/119845320126532 (/home/) + Grepping /tmp/119845323218701 (/etc/) = Backing up = + Backing up /home/ to /usr/local/backup/rsync/home.tar.bz2 + Backing up /etc/ to /usr/local/backup/rsync/etc.tar.bz2 = Performing post operation = + Performing post operations on home.tar.bz2 + Creating ftp script + Starting ftp script (backup/23) + Removing tmp file + Removing tmp file + Performing post operations on etc.tar.bz2 + Creating ftp script + Starting ftp script (backup/23) + Removing tmp file + Removing tmp file = Removing temp files = + Removing /tmp/119845320126532 + Removing /tmp/119845323218701 + Finished at: 24-12-07 07:13:52