# Configuration file for rsbackup package. # The top section contains testing variables that you should change when ready for production # The next section contains values you will be most likely to change. # The final section is rarely changed. # # To modify the ssh port (security), modify the line that says 'ssh -p 22' in the @OPTIONS definition # change the behaviour of the test command $configuration{'TEST_CONDITIONS'} = 0; ########################################################################################################### # the following line puts rsync in test mode. Run this in test mode to ensure you are connecting # change the value to 'return 0;' for production. ########################################################################################################### # When set to 1, will include the --dry-run parameter to rsync, which will do a fake session #$configuration{'CONTROL'}{'--dry-run'} = sub { return 1; } ; ########################################################################################################### # The following variables are set to some defaults, but should be modified to meet your systems parameters ########################################################################################################### # try to get the hostname and domain name via the hostname command. Feel free to modify the following # to whatever you want your hostname and domain name to be. # who gets backup logs $configuration{'MAIL_TO'} = 'backups@example.com'; # full server name/IP and path to backup server, suitable for pasting into the rsync command # NOTE: the default assumes the user is root, the server is named backup in the same domain as this machine # and the target path on the server is /home/backups directory $configuration{'BACKUP_SERVER'} = 'root@server.example.com'; # full server name/rootPath to back up to (or IP) $configuration{'PATH_ON_SERVER'} = '/'; # the below is used to determine the subdirectory on the backup server that is used, and also used to in the # e-mail report. $configuration{'MY_NAME'} = 'server.example.com'; # used to determine target subdir for storage. # The client name. Used to determine the backup subdirectory on the remote machine and also used in the e-mail # report. Do not use spaces in here. $configuration{'CLIENT_NAME'} = 'My Company'; # THIS IS THE ACTUAL PATH USED. It is generally used by calculating from variab # used for other purposes also, such as a root directory for versions. $configuration{'BACKUP_PATH'} = "$configuration{'BACKUP_SERVER'}:$configuration{'PATH_ON_SERVER'}"; # The following list determines the directories on THIS MACHINE that are to be backed up. NOTE: During # upgrades, this entry is assumed to be on one line, upgrade may corrupt this entry if you write it # as a multi-line. $configuration{'DIRS_TO_BACKUP'} = ['/opt/', '/home', '/etc', '/root']; # which directories on source are to be backed up # where to store the logs on this machine. NOTE: log files are compressed and stored, and are not removed # by rsync_backup. The default is to place them in /root/backup_logs, so they are actually backed up # then next day also. $configuration{'LOGDIR'} = '/home/backup_logs'; # log directory, either relative to script or absolute # if the following scripts are set, they are run at the appropriate time # the scripts MUST return a null on stdio to indicate success. Any output on stdio is considered # an error message and the backup is halted immediately with the error being emailed to the # account defined in the cron file. # see additional information with some pre-written scripts in the examples directory of the docs folder $configuration{'INITIALIZATION_SCRIPT'} = $configuration{'TEST_CONDITIONS'} ? '' : '/etc/rsbackup/initialize'; # optional script to execute immediately after configuration file read $configuration{'CLEANUP_SCRIPT'} = $configuration{'TEST_CONDITIONS'} ? '' : '/etc/rsbackup/cleanup'; # optional script to clean up when backup done # following are executed on the TARGET machine before/after the script runs #$configuration{'PREPARE_COMMAND'} = '/opt/camp/rsbackup/rsbackup_p2p/makeVersions'; #$configuration{'CLEANUP_COMMAND'} = 'cleanup'; $configuration{'transport'}{0}{'-name-'} = 'SendEmail'; $configuration{'transport'}{0}{'logFile'} = '/tmp/mail.log'; $configuration{'transport'}{0}{'mailBCC'} = ''; $configuration{'transport'}{0}{'mailCC'} = ''; $configuration{'transport'}{0}{'mailFrom'} = 'root@' . $configuration{'MY_NAME'}; $configuration{'transport'}{0}{'mailServer'} = 'smtp.example.com:port'; $configuration{'transport'}{0}{'mailSubject'} = 'rsbackup_p2p: '; $configuration{'transport'}{0}{'mailTo'} = 'backups@example.com'; $configuration{'transport'}{0}{'otherCLParams'} = '-q'; $configuration{'transport'}{0}{'sendEmailScriptLocation'} = 'sendEmail'; $configuration{'transport'}{0}{'sendScript'} = 'sendEmailScript'; $configuration{'transport'}{0}{'smtpPass'} = 'password'; $configuration{'transport'}{0}{'smtpUser'} = 'username'; $configuration{'transport'}{0}{'tls'} = 'auto'; ########################################################################################################### # You most likely do not need to modify the following lines ########################################################################################################### # THIS IS THE ACTUAL PATH USED. It is generally used by calculating from variables above. Note that it can be # used for other purposes also, such as a root directory for versions. $configuration{'EXCLUDE_FILE'} = '/etc/rsync.exclude'; # location of file containing file patterns to be excluded $configuration{'RSYNC'} = qx/which rsync/; # full path to executables $configuration{'GZIP'} = qx/which gzip/; $configuration{'MPACK'} = qx/which mpack/; # WARNING; the upgrade script assumes @OPTIONS = ( and the closing parenth are on separate lines. # If you reformat, upgrades and reconfigures may be destroyed $configuration{'OPTIONS'} = [ '--compress', # compress the transfer between servers '--verbose', # have verbose output on the backup '--times', # preserve times '--owner', # preserve owner '--group', # preserve group '--ignore-times', # don't skip files that match size and time '--links', # copy symlinks as links '--perms', # sets permissions on target to be same as on source '--recursive', # recurse into subdirectories of all root directories '--size-only', # skip files that match in size '--delete', # delete extraneous files from dest dirs '--delete-excluded', # delete excluded files from dest dirs '--force', # force deletion of dirs even if not empty '--numeric-ids', # don't map uid/gid values by user/group name '--stats', # give some file-transfer stats '--one-file-system', # Do not descend into other devices '--bwlimit=64', # limit backup speed to 64KB/s (which '--rsh="ssh -p 22"' # change the port here if necessary ]; # The CONTROL hash is read in and processed prior to execution of rsync. For each entry in # %CONTROL, the subroutine pointed to by the value is executed. If the sub returns a binary # TRUE, the key is added to the @OPTIONS array and will thus be included. # as an example, to perform a checksum backup (see rsync(1)), on the first Sunday of every month # we can create an entry to do this. # sub firstOfMonth { # my ($configuration{'sec,$configuration{'min,$configuration{'hour,$configuration{'mday,$configuration{'mon,$configuration{'year,$configuration{'wday,$configuration{'yday,$configuration{'isdst) = localtime(time); # return $configuration{'wday == 0 && $configuration{'mday < 7; # day of week is Sunday, and day of month < 7 # } # $configuration{'CONTROL{'--checksum'} = \&firstOfMonth; # add reference to above routine # # Alternately, we can simply create an anonymous sub as follows (the above and below are equivilent) # # Only perform checksum on first Sunday of month # $configuration{'CONTROL{'--checksum'} = sub{my ($configuration{'sec,$configuration{'min,$configuration{'hour,$configuration{'mday,$configuration{'mon,$configuration{'year,$configuration{'wday,$configuration{'yday,$configuration{'isdst) = localtime(time); return $configuration{'wday == 0 && $configuration{'mday < 7; } ; # # when adding any code from here, call rsbackup with the 'test' parameter to test new code added. # # NOTE: using this schema, you can not have multiple entries for any flags to be passed, ie you # MUST have each flag/group of flags only one time. Also, it is your responsibility to ensure # valid flag setups: use the $configuration{'TEST_CONDITIONS flag above to show output instead of executing # NOTE: to have the remote commands work only on certain criteria, use syntax such as # sub firstOfMonth { # my ($configuration{'sec,$configuration{'min,$configuration{'hour,$configuration{'mday,$configuration{'mon,$configuration{'year,$configuration{'wday,$configuration{'yday,$configuration{'isdst) = localtime(time); # return $configuration{'wday == 0; # day of week is Sunday # } # $configuration{'REMOTE_COMMANDS = &firstOfMonth ? "ssh -p 22 root\@backup.example.com 'getStats $configuration{'CLIENT_NAME/$configuration{'MY_NAME'" : '';