bup-backup-sync/README.md

1.9 KiB

Offsite backup archiver

This script is intended to allow for offsite backups of a machine that is mostly suspended in S5 mode (suspend to disk). In regular intervals this machine should be woken, some scripts called, and sent back to suspension. This reduces the amount of online time to the bare minimum.

This script should be called regularly using e.g. Cron in order to work. It has a few files in /var/lib/bup-backup-trigger that store the state between invocations.

The trigger file contains the time stamp of the next backup cycle. Once, this has come, the scripts will be called in a serial manner and the next Monday morning will be set as next time for running the script. Until then, the script terminates quickly and does not perform any operation.

Additionally, there is the option to disable the suspension to happen. This can be useful if other maintenance is to be done that should not be interrupted. Simply call the script with --lock to create a locking file that will prevent a suspension after the scripts have been iterated over. To restore previous behavior, use the cli parameter --unlock, which will just reenable suspension. There is the convenience option --suspend present, that allows to send the machine to sleep after the backup has finished and will no longer suspend automatically.

The scripts to do the actual offsite backup cloning is up to the user. There should be a file (defaults to repos sibling file, see repos.dist) that defines these scripts and the order of their invocation. Note, this is no shell script that is called but line by line interpreted. You can also give another file using the --repos CLI argument.

Registering with Cron

In order to regularly check for updates, you can use cron (or systemd timers) to run the script regularly. To use cron, just put something like this to your crontab (or any file in /etc/cron.d):

*/10 *  * * *   root /root/bup-backup-sync/bup-sync-trigger.sh