Hey Guys,
Several weeks ago I went through the painful process of rebuilding a forum on a domain I help administrate (also known as, my dad has a site and I fix it when it breaks) after it was exploited due to being out of date.
I've since setup a bunch of backup procedures. daily mysqldumps of all databases, weekly backups of sites, and a full backup of everything every two weeks.
These are all placed in a visible password-protected directory so my dad can access them if he wanted to. I have a cron job to rsync the directory locally, I'm going to maintain a two week backup of everything to keep the size down.
Currently, this is the script I use for backups:
Code:
#!/usr/bin/perl
use strict;
use warnings;
my $fileOrFolder = $ARGV[0] or die "You forgot to specify a file or folder name!"; #The name of the file or folder provided during execution of the script
my $upper = "\U$fileOrFolder"; #Convert the file or folder name to uppercase for the label
my $date = `date +%Y_%m_%d`; #Store the date in a variable
chomp($date); #Remove the new line that gets added at the end
print `tar -cvvzhlf "/foo/backups/$fileOrFolder-$date.tar.gz" /foo/$fileOrFolder --atime-preserve --label $upper`;
Someone helped me set it up. I have modified copies of it for the full backup and mysql backups.
After it ran successfully last weekend (had to tweak it a little to work out the kinks), I realized that the full backup is going to take up a lot of space quickly. So I need to modify the script to work a little differently for me.
I'm hoping that someone here can help me set this up. Basically all I need it to do, is check for an existing backup, such as mysite-2008_06_01.tar.gz, then to just append any new files/changes to it, then either rename it to mysite-2008_06_05.tar.gz, or delete the old backup and create the new one.
I would use something like bacula for this, but it's on a shared host.