That's neat, I like the mysqldump part, I haven't gotten around to using that, it'd be nice to make sure my database structures don't get wasted.
Myself, some time ago, I lost an entire month's work due to a minor mistake. So I whipped up alittle backup script awhile back. The only thing it does different from yours is that it backs up my work to 2 other servers.
Incidentally, yes, I use a local cvs repository for my personnal code (then when I finish my work, commit to the company repository). I love the versioning and cvsweb is soooo purdy!
Code:
#!/usr/bin/perl
# makes a backup of local repository and then ftps it to
# another server for cold storage
#
# get today's date
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
#!/usr/bin/perl
# makes a backup of local repository and then ftps it to
# another server for cold storage
#
# get today's date
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
my $datestr = sprintf( "%4i-%02i-%02i", $year + 1900, $mon + 1, $mday );
# first backup the file
my $fname = "$datestr-repository.tar.bz";
my $new_fpath = "/tmp/$fname";
system( "tar cyvvf $new_fpath /home/cvs/repository" ) and die "Couldn't tar up file. Reason: $?";
# now ftp the contents to a usable location
use Net::FTP;
my $conn;
$conn = Net::FTP->new( 'somedomain.com', Debug => 1 ) or die "damn couldn't connect to the ftp server";
$conn->login( 'user', 'pass' );
$conn->binary();
$conn->put( $new_fpath, "backups/$fname" );
$conn->quit();
$conn = Net::FTP->new( '192.168.1.6', Debug => 1 ) or die "damn couldn't connect to the ftp server";
$conn->login( 'user', 'pass' );
$conn->binary();
$conn->put( $new_fpath, "backups/$fname" );
$conn->quit();