Web Hosting Talk







View Full Version : 4webspace backup script


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 --------->

Chicken
07-14-2001, 03:00 AM
I didn't realize they even offered this, heh. Will have to look into it as an alternative to downloading a rather large file... :rolleyes:

WreckRman2
07-14-2001, 03:03 AM
Tell me about it, I downloaded a 900 meg gzip the other night hehe.

Keeg
07-14-2001, 04:18 AM
we don't offer it (yet) I'm not sure who posted it but it wasn't ready for the other raq accounts yet. it works fine for our shared accounts as all servers are configured identically, however there are many variations on 4webspace and dedicated servers, hence the script wont work on those servers it will die when it reaches a spot that doesn't jive.

Steve

WreckRman2
07-14-2001, 04:43 AM
hey steve,

http://www.4webspace.com/support.html


Got that script from your FAQ page on 4webspace. :-)

dutchie
07-14-2001, 09:29 AM
And i installed it according to instructions of Dave Rowlands !

Should i remove it ????