Annotation of sludge_scripts/backup.pl, revision 1.2
1.1 nick 1: #!/usr/bin/perl -w
2:
3: use strict;
4: use Data::Dumper;
5:
1.2 ! nick 6: my $VERSION = q/$Id$/;
1.1 nick 7: my $REMOTE = "nick\@demandred.dyndns.org";
8: my $OPTIONS = "-avxz\ -e\ ssh\ --delete";
9: my $RSYNC = "/usr/bin/rsync";
10: my $LOGDIR = $ARGV[0] || "/home/backup/logs";
11: my $DATE = `date +%Y%m%d`;
12: my $BACKUP_DIR = "/home/backup/backups";
13:
14: my %DIRS = (
15: demandred => [
16: "/home/nick/database-backup.dump.gz",
17: "/home/nick/database-backup.dump.yesterday.gz",
18: "/home/nick/DroidBackups",
19: "/home/cvs",
20: "/home/nick/bbs",
21: "/home/nick/notes",
22: "/home/httpd",
23: "/home/nick/Documents",
24: "/home/nick/mail",
25: "/home/nick/mail-backup",
26: ],
27: winshare => [
28: "/home/winshare/Documents",
29: "/home/winshare/Pictures",
30: "/home/winshare/Receipts",
31: "/home/winshare/Shared\\ Docs",
32: "/home/winshare/Backgrounds",
33: ],
34: lanfear => [
35: "/home/backup/systems/lanfear/home/nick/Documents",
36: "/home/backup/systems/lanfear/home/nick/Receipts",
37: "/home/backup/systems/lanfear/home/nick/Nick\\'s\\ Pictures",
38: "/home/backup/systems/lanfear/home/nick/projects",
39: "/home/backup/systems/lanfear/home/nick/notes",
40: ],
41: );
42:
43: foreach my $backup ( keys %DIRS )
44: {
45: foreach my $dir ( @{ $DIRS{$backup} } )
46: {
47: my $dest = $BACKUP_DIR . "/" . $backup;
48: my $command = "/usr/bin/rsync $OPTIONS \"$REMOTE:$dir\" $dest";
49: print "Backing up $REMOTE:$dir to $dest\n$command\n";
1.2 ! nick 50: system( "mkdir -p $dest" );
1.1 nick 51: system( $command );
52: }
53: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>