WreckRman2
07-14-2001, 02:34 AM
Does anyone use this backup script with your 4webspace account? If I read the script right it backups your files on thier server 216.234.161.17? Anyone...
A few things to note about this backup script:
-This backup script is not supported by Cobalt Networks
-You will need to change the username and password to match the one given to
you by Tera-byte
-This script will need to be put in the /etc/cron.daily directory and
chmodded to 700
Things that the backup script will do for you:
-Will keep a 4 day backup of the critical files needed to resetup your raq
in case of problems.
-Will keep a 2 day backup of the user's site files
backup.pl
<--------- start here --------->
#!/usr/bin/perl
$hostname = `/bin/hostname`;
chop ($hostname);
$username = "put username here"
$password = "put password here"
mkdir ("/home/tmp/.backup", 0700);
`/bin/tar czfp /home/tmp/.backup/$hostname.tar /etc /home/quota.*
/usr/admserv /var/lib/pgsql /home/tmp/.backup/ hostname.3day.tar
open (NETRC, ">/.netrc");
print NETRC "machine 216.234.161.17\n";
print NETRC "login $username\n";
print NETRC "password $password\n";
print NETRC "macdef init\n";
print NETRC "binary\n";
print NETRC "cd $hostname\n";
print NETRC "del $hostname.3day.tar.4\n";
print NETRC "ren $hostname.3day.tar.3 $hostname.3day.tar.4\n";
print NETRC "ren $hostname.3day.tar.2 $hostname.3day.tar.3\n";
print NETRC "ren $hostname.3day.tar $hostname.3day.tar.2\n";
print NETRC "put /home/tmp/.backup/$hostname.3day.tar $hostname.3day.tar\n";
print NETRC "quit\n\n";
close (NETRC);
chmod (0600, "/.netrc");
`/usr/bin/ftp 216.234.161.17`;
unlink ("/.netrc");
unlink ("/home/tmp/.backup/$hostname.3day.tar");
foreach ($x = 1 ; $x <= 200 ; $x++) {
mkdir ("/home/tmp/.backup", 0700);
`/bin/tar cfp /home/tmp/.backup/$hostname.site$x.tar /home/sites/site$x`;
open (NETRC, ">/.netrc");
print NETRC "machine 216.234.161.17\n";
print NETRC "login $username\n";
print NETRC "password $password\n";
print NETRC "macdef init\n";
print NETRC "binary\n";
print NETRC "cd $hostname\n";
print NETRC "del $hostname.site$x.tar.old\n";
print NETRC "ren $hostname.site$x.tar $hostname.site$x.tar.old\n";
print NETRC "put /home/tmp/.backup/$hostname.site$x.tar
$hostname.site$x.tar\n";
print NETRC "quit\n\n";
close (NETRC);
chmod (0600, "/.netrc");
`/usr/bin/ftp 216.234.161.17`;
unlink ("/.netrc");
unlink ("/home/tmp/.backup/$hostname.site$x.tar");
}
<--------- End Script --------->
A few things to note about this backup script:
-This backup script is not supported by Cobalt Networks
-You will need to change the username and password to match the one given to
you by Tera-byte
-This script will need to be put in the /etc/cron.daily directory and
chmodded to 700
Things that the backup script will do for you:
-Will keep a 4 day backup of the critical files needed to resetup your raq
in case of problems.
-Will keep a 2 day backup of the user's site files
backup.pl
<--------- start here --------->
#!/usr/bin/perl
$hostname = `/bin/hostname`;
chop ($hostname);
$username = "put username here"
$password = "put password here"
mkdir ("/home/tmp/.backup", 0700);
`/bin/tar czfp /home/tmp/.backup/$hostname.tar /etc /home/quota.*
/usr/admserv /var/lib/pgsql /home/tmp/.backup/ hostname.3day.tar
open (NETRC, ">/.netrc");
print NETRC "machine 216.234.161.17\n";
print NETRC "login $username\n";
print NETRC "password $password\n";
print NETRC "macdef init\n";
print NETRC "binary\n";
print NETRC "cd $hostname\n";
print NETRC "del $hostname.3day.tar.4\n";
print NETRC "ren $hostname.3day.tar.3 $hostname.3day.tar.4\n";
print NETRC "ren $hostname.3day.tar.2 $hostname.3day.tar.3\n";
print NETRC "ren $hostname.3day.tar $hostname.3day.tar.2\n";
print NETRC "put /home/tmp/.backup/$hostname.3day.tar $hostname.3day.tar\n";
print NETRC "quit\n\n";
close (NETRC);
chmod (0600, "/.netrc");
`/usr/bin/ftp 216.234.161.17`;
unlink ("/.netrc");
unlink ("/home/tmp/.backup/$hostname.3day.tar");
foreach ($x = 1 ; $x <= 200 ; $x++) {
mkdir ("/home/tmp/.backup", 0700);
`/bin/tar cfp /home/tmp/.backup/$hostname.site$x.tar /home/sites/site$x`;
open (NETRC, ">/.netrc");
print NETRC "machine 216.234.161.17\n";
print NETRC "login $username\n";
print NETRC "password $password\n";
print NETRC "macdef init\n";
print NETRC "binary\n";
print NETRC "cd $hostname\n";
print NETRC "del $hostname.site$x.tar.old\n";
print NETRC "ren $hostname.site$x.tar $hostname.site$x.tar.old\n";
print NETRC "put /home/tmp/.backup/$hostname.site$x.tar
$hostname.site$x.tar\n";
print NETRC "quit\n\n";
close (NETRC);
chmod (0600, "/.netrc");
`/usr/bin/ftp 216.234.161.17`;
unlink ("/.netrc");
unlink ("/home/tmp/.backup/$hostname.site$x.tar");
}
<--------- End Script --------->
