======= Simple backupscript utilizing rsync and hardlinks =======
===== Synopsis ======
Backup remote machines using ssh and rsync, utilizing hardlinks for files that has not changed since last backup
===== Configuration =====
BACKUPUSER=backup
BASEDIR=/backup/
CONFDIR=/usr/local/etc/backup
DIR="/etc /usr/local/etc"
^ setting ^ description ^
| backupuser | is the user rsync users to connect to the remote machine, change this to the user you want to use |
| basedir | is the directory your backups are stored in. A file hieracy will be created here /{basedir}/{servername}/{date}/{directory} |
| confdir | is the directory with local configuration files (excludes and per-host configuration) |
| dir | default directories to backup - this can be changed on a per-host or hostgroup basis |
For per-host configuration you need to create ''hostconf.sh'' in ''$CONFDIR'' (default is ''/usr/local/etc/backup/hostconf.sh'')
This file needs a host_conf function which will be called with the hostname as an option
backup script will run fine without this initial configuration
example:
host_conf()
{
case ${1} in
web*)
DIR="${DIR} /usr/local/www"
HOSTGROUP="web freebsd denmark"
;;
esac
}
Furthermore the system looks for exclude files named: ''exclude.default exclude.servername exclude.hostgroup''
using the above example and a hostname of ''web01.example.org'', the following files would be included (if they exist):
exclude.default
exclude.web01.example.org
exclude.web
exclude.freebsd
exclude.denmark
note: if you specify DEFAULT_EXCLUDE=0 for a host, ''exclude.default'' will not be loaded.
These files need to hold regex or fullname of files to exclude
example:
*.zip
*.t[gb]z
*.flv
or look at my example files: hostconf.sh exclude.default exclude.web exclude.mysql
Hint: you can use zfs (or another file system with compression enabled) to have your easily compressed files etc compressed on-the-fly
===== Syntax =====
$path/backup.sh host1 host2 host3
===== Download =====
Latest version 1.1 {{files:backup:backup.sh}}
===== Changelog =====
=== 1.1 ===
o Initial public release
o Hostgroup capability added
=== 1.0 ===
o unreleased initial version