#!/usr/bin/perl # $Id: rsync_snapshot_sender 388 2005-11-09 18:33:10Z jhealy $ # =head1 NAME rsync_snapshot_sender =head1 SYNOPSIS ./rsync_snapshot_sender config-file [config-file-2 ... config-file-N] =head1 ABSTRACT Performs a full-incremental backup using hard links. This script assumes that the destination of the backup is a remote networked machine running L. See L for more information. =head1 DESCRIPTION This script uses rsync to back up a set of directories to a specified remote machine running L. If you just want to back up files to the local machine, use L instead. Simply invoke the script with the names of one or more configuration files as the arguments. The script will process each config file in turn and perform the backup specified therein. For more information, refer to the online documentation for this package: L =cut # Report errors well use strict; use warnings; use RsyncSnapshot ':subs', ':vars'; # This script is a sender, so only run sender code in the conf file $RsyncSnapshot::SENDER = 1; if ($#ARGV < 0) { logDie("\nMust supply a list of configuration files as arguments.\n\n"); } foreach my $conffile (@ARGV) { unless (parseConfig($conffile)) { next; } unless (defined($SSH_HOST) && defined($SSH_KEY)) { logWarn("Must specify SSH host and key for networked backups."); next } debug("Starting backup for $CONFIG_DESCRIPTION\n", 0); # run the rsync command my %results = (); foreach my $source (@SOURCES) { # lastBackup param is undef, as there is no directory here to check # links against. Receiving side must find previous dir. splitRsync($SPLIT, $source, "$BACKUP_ROOT/$DEST", undef, \%RSYNC_OPTIONS, \%results, @RSYNC_EXCLUDES); } debug("Finished backup for $CONFIG_DESCRIPTION\n", 0); printResults(%results); } =head1 SEE ALSO Full documentation for this package is located on the web: L =head1 AUTHOR Jason Healy, Suffield Academy =head1 COPYRIGHT AND LICENSE Copyright 2005 by Jason Healy This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut