Ok, it took me a while to work out how to do all this...but I thought I would share it with you lot. To start with I had a look around for a decent script that would backup my SQL databases and sites, but I couldn't find any. This is what I came up with;
#####################################
use CGI::Carp qw(fatalsToBrowser);
use Time::HiRes;
#se tthis to your emailo address that you want alerting on...
$webmaster = 'webmaster@ace-installer.com';
# start the timer...
$start_time = time;
# backup SQL stuff...
`mysqldump -uusername -ppassword ace_clipart > /home/dumps/ace_clipart.sql`;
`mysqldump -uusername -ppassword ace_installer_shop > /home/dumps/ace_installer_shop.sql`;
`mysqldump -uusername -ppassword ace_templates > /home/dumps/ace_templates.sql`;
# backup all home directory...
`tar -cf installer.tar /home/ace-installer.com/*`;
`gzip -c installer.tar > /home/dumps/installer.tar.gz`;
`tar -cf clipart.tar /home/ace-clipart.com/*`;
`gzip -c clipart.tar > /home/dumps/clipart.tar.gz`;
`tar -cf wwwtemplates.tar /home/wwwtemplates.com/*`;
`gzip -c wwwtemplates.tar > /home/dumps/wwwtemplates.tar.gz`;
`tar -cf templates.tar /home/templates.ws/*`;
`gzip -c templates.tar > /home/dumps/templates.tar.gz`;
`tar -cf 123carlinks.tar /home/123carlinks.com/*`;
`gzip -c 123carlinks.tar > /home/dumps/123carlinks.tar.gz`;
`tar -cf acetemplates.tar /home/ace-templates.com/*`;
`gzip -c acetemplates.tar > /home/dumps/acetemplates.tar.gz`;
$end_time = time;
$taken_time = $end_time - $start_time;
open(MAIL,"|/usr/sbin/sendmail -t");
print MAIL "To: $webmaster \n";
print MAIL "From: $webmaster \n";
print MAIL "Reply-to: $webmaster \n";
print MAIL "Subject: RE Server Backup... \n\n";
print MAIL "The server has been backed up...it took $taken_time to backup the sites and MySQL databases...\n";
print MAIL "\n \n Thanks";
print MAIL "\n";
print MAIL "A.J.Newby \n";
print MAIL "Ace Installer \n";
close(MAIL);
Obviously you can hack this script to your hearts conent. You may want to even back up the whol e/home/ directory in one tar.gz file...its completly up to you. I just thought i would share it with you guys cos I'm nice like that
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
#!/usr/bin/perl #####################################
use CGI::Carp qw(fatalsToBrowser);
use Time::HiRes;
#se tthis to your emailo address that you want alerting on...
$webmaster = 'webmaster@ace-installer.com';
# start the timer...
$start_time = time;
# backup SQL stuff...
`mysqldump -uusername -ppassword ace_clipart > /home/dumps/ace_clipart.sql`;
`mysqldump -uusername -ppassword ace_installer_shop > /home/dumps/ace_installer_shop.sql`;
`mysqldump -uusername -ppassword ace_templates > /home/dumps/ace_templates.sql`;
# backup all home directory...
`tar -cf installer.tar /home/ace-installer.com/*`;
`gzip -c installer.tar > /home/dumps/installer.tar.gz`;
`tar -cf clipart.tar /home/ace-clipart.com/*`;
`gzip -c clipart.tar > /home/dumps/clipart.tar.gz`;
`tar -cf wwwtemplates.tar /home/wwwtemplates.com/*`;
`gzip -c wwwtemplates.tar > /home/dumps/wwwtemplates.tar.gz`;
`tar -cf templates.tar /home/templates.ws/*`;
`gzip -c templates.tar > /home/dumps/templates.tar.gz`;
`tar -cf 123carlinks.tar /home/123carlinks.com/*`;
`gzip -c 123carlinks.tar > /home/dumps/123carlinks.tar.gz`;
`tar -cf acetemplates.tar /home/ace-templates.com/*`;
`gzip -c acetemplates.tar > /home/dumps/acetemplates.tar.gz`;
$end_time = time;
$taken_time = $end_time - $start_time;
open(MAIL,"|/usr/sbin/sendmail -t");
print MAIL "To: $webmaster \n";
print MAIL "From: $webmaster \n";
print MAIL "Reply-to: $webmaster \n";
print MAIL "Subject: RE Server Backup... \n\n";
print MAIL "The server has been backed up...it took $taken_time to backup the sites and MySQL databases...\n";
print MAIL "\n \n Thanks";
print MAIL "\n";
print MAIL "A.J.Newby \n";
print MAIL "Ace Installer \n";
close(MAIL);
Obviously you can hack this script to your hearts conent. You may want to even back up the whol e/home/ directory in one tar.gz file...its completly up to you. I just thought i would share it with you guys cos I'm nice like that
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!