# 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 ########################################################################################################### # 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 # $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 $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 $BACKUP_SERVER = 'root@backup.example.com'; # full server name/rootPath to back up to (or IP) $PATH_ON_SERVER = '/home/backups'; # the below is used to determine the subdirectory on the backup server that is used, and also used to in the # e-mail report. $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. $CLIENT_NAME = 'ClientName'; # 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. $BACKUP_PATH = "$BACKUP_SERVER:$PATH_ON_SERVER/$CLIENT_NAME/$MY_NAME/backup"; # 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. @DIRS_TO_BACKUP = ('/etc', '/root', '/home'); # 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. $LOGDIR = '/root/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 $INITIALIZATION_SCRIPT = '/etc/rsbackup/initialize'; # optional script to execute immediately after configuration file read $CLEANUP_SCRIPT = '/etc/rsbackup/cleanup'; # optional script to clean up when backup done $$transports{0}{ '-name-' } = 'FTP Upload'; $$transports{0}{ 'server' } = 'localhost'; $$transports{0}{ 'port' } = 21; $$transports{0}{ 'timeout' } = 120; # seconds $$transports{0}{ 'directory' } = ''; $$transports{0}{ 'Username' } = 'anonymous'; $$transports{0}{ 'Password' } = '-anonymous@'; $$transports{0}{ 'Passive Mode' } = 1; $$transports{0}{ 'Transfer Type' } = 'binary'; $$transports{1}{'-name-'} = 'HTTP Upload'; $$transports{1}{'URL'} = 'http://my.camp.server.example.com/computer_asset_manager/modules/sysinfo/upload_sysinfo_report.php'; $$transports{1}{'key for client'} = 'client'; $$transports{1}{'key for date'} = 'report_date'; $$transports{1}{'key for hostname'} = 'hostname'; $$transports{1}{'key for report'} = 'report'; $$transports{1}{'key for serial number'} = 'serialnumber'; $$transports{1}{'sendScript'} = 'upload_http'; $$transports{2}{'-name-'} = 'SendEmail'; $$transports{2}{'logFile'} = '/tmp/mail.log'; $$transports{2}{'mailBCC'} = ''; $$transports{2}{'mailCC'} = ''; $$transports{2}{'mailFrom'} = 'root@$MY_NAME'; $$transports{2}{'mailServer'} = 'smtp.example.com:port'; $$transports{2}{'mailSubject'} = 'sysinfo-client: $hostname $reportDate'; $$transports{2}{'mailTo'} = 'admin@example.com'; $$transports{2}{'otherCLParams'} = '-q'; $$transports{2}{'sendEmailScriptLocation'} = 'sendEmail'; $$transports{2}{'sendScript'} = 'sendEmailScript'; $$transports{2}{'smtpPass'} = 'password'; $$transports{2}{'smtpUser'} = 'username'; $$transports{2}{'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. $BACKUP_PATH = "$BACKUP_SERVER:$PATH_ON_SERVER/$CLIENT_NAME/$MY_NAME/backup"; $EXCLUDE_FILE = '/etc/rsync.exclude'; # location of file containing file patterns to be excluded $RSYNC = qx/which rsync/; chomp $RSYNC; # full path to rsync executable $GZIP = qx/which gzip/; chomp $GZIP; $MPACK = qx/which mpack/; chomp $MPACK; # WARNING; the upgrade script assumes @OPTIONS = ( and the closing parenth are on separate lines. # If you reformat, upgrades and reconfigures may be destroyed @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 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # return $wday == 0 && $mday < 7; # day of week is Sunday, and day of month < 7 # } # $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 # $CONTROL{'--checksum'} = sub{my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); return $wday == 0 && $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 $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 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # return $wday == 0; # day of week is Sunday # } # $REMOTE_COMMANDS = &firstOfMonth ? "ssh -p 22 root\@backup.example.com 'getStats $CLIENT_NAME/$MY_NAME'" : '';