-
Homepage: github.com/mstrauss/backupman
A tool for system administrators to easily configure pull-over-SSH backups. Install it on your backup server and pull your backups over SSH from there.
When you have servers on the Internet or in a DMZ they are kind of “untrusted” because they are vulnerable to become hacked/cracked. It is therefore a best practice to pull backups from there instead of letting these servers push their data to the backup servers. Advantage: When doing SSH-pull you do not have to store any kind of authentication information on your “untrusted” remote servers.
Currently these types of backups are configurable:
-
tar - the tar becomes compressed on the source and is streamed over SSH to the backup server; no tar files are created on the source side.
-
rsync - changes on the source side become synchronized in a very efficient way to a copy on the backup server; you get a 1:1 copy of your data on the backup server
-
mysqldump - this simply does a full dump of all your databases, compresses it and streams it over to the backup server
To run a fully configured backup configured in /etc/backup_man/somehost
run
backup_man somehost
To run a backup with custom log destination (default is /var/log/backup_man.log
) and with a custom configuration file path use
backup_man -l /full/path/to/logfile /full/path/to/configfile
Full synopsis:
Usage: backup_man [options] {configname | configpath} Options are: -l, --logpath=PATH Path to the log file. This can NOT be configured in the config file. Default: /var/log/backup_man.log -d, --debug Debug mode. Much output on screen and in the log file. -h, --help Show this help message.
-
gems: log4r
-
sudo gem install backup_man
-
remove the password from your ssh private key, e.g. do +ssh-keygen -p+
-
create an configuration file in
/etc/backup_man
, copy this example and adapt to your needs:############################################################################ # = Global settings # These settings are valid for all latter backup definitions # the default destination directory; if you do not set this it defaults to # /var/backups/backup_man DESTDIR = "/Users/srm/Documents/Backups" # where the lockfiles go (defaults to /var/lock/backup_man/_backupname_); # backup_man ensures, that each backup task can only run once at a time and # uses lockfiles for this LOCKDIR = "#{DESTDIR}" # ssh_app defines the call to ssh with command line parameters, e.g. if you # want to use a special identity file; SSH_APP defaults to 'ssh' SSH_APP='ssh -i /Users/srm/.ssh/id_rsa' ############################################################################ # = Helper variables # These are just used in this file to ease the backup definitions dirs_to_backup = [ "/etc", "/home", "/root", "/srv", "/var/backups", "/var/cache/git", "/var/log", "/var/mail", "/var/rails", "/var/svn", "/var/www" ] ############################################################################ # = Backup defintions # Currently there are these types of backups: # * Tar - as the name says; simple tar of a bunch of directories into a tgz # * Rsync - rsync of a bunch of directories # * Mysql - does a simple mysqldump of all databases # # == Common settings # * backup: an array of directories to backup # * to: the destination directory on the local machine (defaults to DESTDIR) # * onlyif: specify a condition (as Ruby code) which is checked before the # actual backup run; it must evaluate true to have the backup run - see the # homepage for details on how to write conditions # Tar.new( 'akeso' ) do |b| b.backup dirs_to_backup # in this example, this job only runs on saturdays and only if the backup # does not exist already b.onlyif 'Date.today.cwday == 6 && !exists?' end Rsync.new( 'akeso' ) do |b| b.backup dirs_to_backup # rsync backups go to _DESTDIR_/rsync per default; to override use the "to" # setting: ## b.to '/var/backup/custom-rsync-destination' end Mysql.new( 'akeso' ) do |b| # in this case, we simply do not run the backup if we already have one b.onlyif '!exists?' end
-
configure passwordless ssh login via certificates, e.g. do a +ssh-copy-id user@remotehostname+
- Author
-
Markus Strauss (markus@itstrauss.eu)
- Copyright
-
Copyright ©2009 Markus Strauss
- License
-
GPLv3 (www.gnu.org/licenses/gpl-3.0.txt)