1. ``/etc/bacaprc``
2. ``/etc/bacap/bacaprc``
3. ``bacaprc`` in the same directory as the ``bacap`` script
+4. Optional parameter passed as argument to the script
+5. ``$CONFIG_PATH/$HOST/bacaprc``
Order is important, since all files are read (if possible) and values in the
last configuration file read overwrites old values. The script takes an optional
-parameter, which is another location to look for a configuration file. The
-configuration file passed as argument will be read last, and an error will be
-printed if can't be found (no error is issued if any of the other configuration
-files are missing).
+parameter, which is another location to look for a configuration file. If the
+configuration file passed as argument can't be found, an error will be printed
+(no error is issued if any of the other configuration files are missing).
+Also, config options could be specified on a per host basis by creating a
+``bacaprc`` file in ``$CONFIG_PATH/$HOST``. As a side effect of this,
+configuration file(s) are read initially and each time the script backups a new
+host. So the configuration file(s) are read at least two times even if you
+backup one host.
The configuration file is a Bash_ script too, and these are the default values:
mkdir -p $CONFIG_PATH
-The create a directory for each host you want to backup there, the directory
+Then create a directory for each host you want to backup there, the directory
name should be the name of the host (as you would use to connect to it using
ssh_). For now let's say we will only backup ``localhost``::
``/etc`` and ``/home``::
echo /etc > $CONFIG_PATH/$LOCALHOST/paths
- echo /home > $CONFIG_PATH/$LOCALHOST/paths
+ echo /home >> $CONFIG_PATH/$LOCALHOST/paths
But sometimes there are things there that you don't want to backup, in that
case you can create a file named ``excludes`` too, and write which paths you
echo /home/rata/ > $CONFIG_PATH/$LOCALHOST/excludes
+Also, if you don't want to exclude files matching some pattern, you can create
+a file named ``includes`` with the patterns you want to include (you can use
+anything supported by the ``--include-from`` rsync_ option)
+
That's pretty much it. If you want to add other hosts, just create the host
directory and the needed host configuration files.
here, but if you are completely lost, you can add this line to ``/etc/crontab``
to make a daily backup at 6:30::
- 25 6 * * * root /path/to/bacap
+ 30 6 * * * root /path/to/bacap
If you are a Debian_ user, you can also simply install the script in
``/etc/cron.daily`` (or make a symlink or something similar) and you are set.
A symbolic link is created at the end of the backup, with the name
``$BACKUP_PATH/$host/current``, and pointing to the newly created directory.
+Also, to see what have actually changed between two backups you can run rsync
+with your usual flags plus "-nv --delete". For example if you just use "-a", to
+see the differences between lolaus/2010-07-11 and lolaus/2010-07-12 you can run::
+ rsync -nav --delete lolaus/2010-07-11/ lolaus/2010-07-12/
Similar alternatives