Web Hosting Talk







View Full Version : Here is a Back Up System


brandonk
08-23-2001, 01:01 AM
Hello!

Let me tell ya, I've had my share of hard drive failures and hack attempts leaving me without a useable system. So what happens? Well the system is restored to OS, patches are installed, and I "restore" the system with the handy little .raq file that I downloaded every day. WRONG, actually, you create every site and username in the order in which they were created and then you hit "Restore" only to find "unkown error" on every single file. So what next? Well you notify your clients and let them know that they need to reupload everything (making them very unhappy). I have had more then enough of this situation, and I've finally taken advice from others and setup a back up system THAT WORKS! It will backup everything essential to restoring the server to functional state with all site files, etc!

Before I give you the instructions, I would like to thank "webbcite" for his helpful ftpbackup commands, and of course the notorious Cobalt-Users group for the many posts reassuring everyone that this *does* work.

In a nutshell... The system utilizes ftpbackup and a perl script run via cron.

1) You will need to install ftpbackup on your server... follow the following instructions:
- telnet into the server as admin
- gain root access, type su - and enter your root password
- type wget http://netsw.org/net/ip/filetrans/ftp/ftpbackup/ftpbackup-2.1.tar.gz
- type tar zxvf ftpbackup-2.1.tar.gz
- type cd ftpbackup-2.1
- type make
- type make install

2) Now that we have ftpbackup installed on the server, we need to setup the script that makes the magic...
- telnet into the server as admin
- gain root access, type su - and enter your root password
- type pico -w backup.pl
- copy the script below, and paste it into the telnet window

#!/usr/bin/perl

#FTP Server Information here
$ftps = "server name here";
$ftpu = "username here";
$ftpp = "password here";
$serv = "server name";

system("/bin/tar cfp - /home | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-home.tar.gz");
system("/bin/tar cfp - /etc | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-etc.tar.gz");
system("/bin/tar cfp - /var | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-var.tar.gz");
system("/bin/tar cfp - /usr/admserv | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-admserv.tar.gz");
system("/bin/tar cfp - /usr/local | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-local.tar.gz");


-edit the "FTP Server Information here" variables to match your own (server name is the hostname or IP address of the ftp address where the files will be stored, username and password are for the ftp server, and server name is simply away of naming the files, ex: server1)
- exit pico hold Control-X
- answer yes to save changes
- type chmod 755 backup.pl

3) Now we need to put the back up script in the appropriate place.

If you would like the backup script to run daily, do this:
- type mv backup.pl /etc/cron.daily/backup.pl

If you would like the backup script to run weekly, do this:
- type mv backup.pl /etc/cron.weekly/backup.pl

If you would like the backup script to run monthly, do this:
- type mv backup.pl /etc/cron.monthly/backup.pl

4) You're done! The script should now run each day, week, month depending on which one you choose.


How do you restore it? Can't forget the other half of the deal...

Go into the new box you want to restore the data to... Hopefully this is the same box that you backed up from, I believe that it will have to be the same kind (ex, RaQ3 instead of RaQ4).

Upload your five files to /home/sites/home/users/admin, and then follow the following instructions as root. Please replace $serv with the one you used.

cd /home
tar xvf /home/sites/home/users/admin/$serv-home.tar.gz
cd /etc
tar xvf /home/sites/home/users/admin/$serv-etc.tar.gz
cd /var
tar xvf /home/sites/home/users/admin/$serv-var.tar.gz
cd /usr/admserv
tar xvf /home/sites/home/users/admin/$serv-admserv.tar.gz
cd /usr/local
tar xvf /home/sites/home/users/admin/$serv-local.tar.gz

Go to the web interface using the password from the old box. Select "maintenance" and then "reboot." Reboot the system and you're done.

Please keep in mind that if you choose to use this, it is at your *own* risk. I cannot be held responsible should something go wrong.

Good luck!

cgisupp
08-23-2001, 02:32 AM
Brandon,
thanks for sharing this with us, I have been using ftpbackup for a few months now and it has worked fine. Thankfully I haven't had a disaster scenario occur where I have had to restore any of the files..

- Bruce

dutchie
08-23-2001, 04:20 AM
Brandon you make my day (you might even make more if my server crashes :)).

I'm gonna order a extra server right now, and test it for a week or 2, before i let it loose on my clients server.

I'll let you know if i run into troubles...

THNKS !

SI-Chris
08-23-2001, 04:33 AM
Originally posted by dutchie
I'll let you know if i run into troubles...Let us know even if you don't! I'd be interested in hearing about the results of your tests, good or bad.

huck
08-23-2001, 09:12 AM
Brandon .... nice bit of scripting.

What about the /lib directory? There are a number of files stored in here that are added after a clean install. I have never tried to overwrite a /lib directory. You might be able to untar the lib backup and just do not do any overwrites?

Any thoughts on this?

Do you have any performance measures?
I am running the script and gzip and tar are consuming about 40-60% of the cpu. The are running at a priority of 11. I wonder if this was an issue you could renice the program to run at a lower priority?

Also, I've been told that the .raq files are nothing more than tarballs with some additional header info.

skymedia
08-23-2001, 12:43 PM
Hi,

Thankyou very much Brandon. If this backup procedure works fine, I'll sleep at night, and will have less nightmares about my RaQ crashing :)

My question is... does it work with MySQL, Postgree, etc.?
Or should I look for another backup alternative for databases?

Best regards,

Adrián Boismoreau
___________________
SKY media
www.skymedia.com.ar

brandonk
08-23-2001, 01:46 PM
Originally posted by huck
Brandon .... nice bit of scripting.

What about the /lib directory? There are a number of files stored in here that are added after a clean install

Also, I've been told that the .raq files are nothing more than tarballs with some additional header info.

I just went off of some information that I found in the Cobalt Users Group. They had instructions for tar'in up the files by hand (login to telnet, cd, tar, etc) and they did these 5 "areas". They then restored the OS, uploaded the back ups, untar'd em and it worked like a charm. So I'm just going by what others have done, because I don't have a RaQ available right now that isn't being used by clients.

As far as the .raq files go, it may be true. But I tried stripping the headers from a 2GB file, and I just couldn't do it.

brandonk
08-23-2001, 01:47 PM
Originally posted by skymedia
My question is... does it work with MySQL, Postgree, etc.?


MySQL data is stored under /home, so yes it covers it. Not sure about Postgree though...

webbcite
08-23-2001, 03:52 PM
Originally posted by brandonk
Before I give you the instructions, I would like to thank "webbcite" for his helpful ftpbackup commands, and of course the notorious Cobalt-Users group for the many posts reassuring everyone that this *does* work.

I take no credit for the commands...I found 95% of my information in the Cobalt archives and searching Google for hours.

I have been using this method for about six months. I have no first hand knowledge of restoring (although I did test a little).

I too am curious about how it will restore a system that is not "vanilla". Something with PHP, MySQL , webalizer etc...

Hopefully **knock on wood** I won't HAVE to test it out...

brandonk
08-23-2001, 05:50 PM
Originally posted by webbcite
I too am curious about how it will restore a system that is not "vanilla". Something with PHP, MySQL , webalizer etc...

Hopefully **knock on wood** I won't HAVE to test it out...

Well if you need to restore, you want to return it to what the machine was, so knowing what updates were installed, and other things like PHP, MySQL, Webalizer is all important. Just make sure that you've installed those and THEN restore and you shouldn't have any problems.

HostingDirect
08-26-2001, 11:59 AM
brandonk,
We set this up and it works great with one exception. We have two Raqs with Rackshack and we are using this code to backup each server to one another. We created a new account on each of the servers with enough space to back up the other server.

Since this set up backs up the home directory we are finding when the 1st machine backs up the /home/sites* directory to the 2nd machine it uses about 250 mb but when we back up the 2nd machine to the 1st machine (which also backs up the home directory) the first machine now gets the 2nd machine's customer data to include a the backed up data of the 1st machine making the backup size grow considerable. Well you can see where this nasty situation is going.

My question to anyone is how would we set up the script to exclude the /home/sites/www.backup.com or siteX directory so we do not back up the backups?

Boy this can be very confusing to follow.

Thanks in advance for any suggestions or assistance!

dektong
08-26-2001, 12:42 PM
Originally posted by Curt
My question to anyone is how would we set up the script to exclude the /home/sites/www.backup.com or siteX directory so we do not back up the backups?


I have never done this nor I have tried this ... But this might be easily done with tar's own option tags ... if you do 'tar --help', down in the list you will see the following information:


tar --help
.
.
.

Local file selection:
-C, --directory=DIR change to directory DIR
-T, --files-from=NAME get names to extract or create from file NAME
--null -T reads null-terminated names, disable -C
--exclude=PATTERN exclude files, given as a globbing PATTERN
-X, --exclude-from=FILE exclude globbing patterns listed in FILE
.
.
.


I am guessing the '-T' and especially '-X' option tags will probably do it ... you just have to make a file containing the files you want to include or exclude .... Anyway ... just and idea ....

Another way ... why do you have to backup to /home ? Why not using some other directory? That way you won't get the recursive backup ... Restore it only when you need it ... :)

cheers,
:beer:

ljprevo
08-26-2001, 12:43 PM
Originally posted by Curt

My question to anyone is how would we set up the script to exclude the /home/sites/www.backup.com or siteX directory so we do not back up the backups?

Boy this can be very confusing to follow.

Thanks in advance for any suggestions or assistance!

Thanks for bringing that up. Never though about this. I have a high speed connect at home I was thinking about setting up a FTP server on to avoid this. I don't know your situation though.

You would really need to back up somewhere outside the /homes/sites/ directory is my guess.

Marty
08-26-2001, 05:21 PM
Actually I am the owner of the other server that Curt is using to backup too. I think I know how to get around this. We could modify the backup.pl file to the following:

#!/path/to/perl

Config Variables

system('mv /home/sites/backup.site.name/web/* /temp/');

do all the tar and ftp steps there

system('mv /temp/* /home/sites/backup.site.name/web/');



This just temporarily moves the backup files of the other server out of the way while the backup is taking place.

brandonk
08-26-2001, 08:19 PM
Originally posted by Marty
Actually I am the owner of the other server that Curt is using to backup too. I think I know how to get around this. We could modify the backup.pl file to the following:

#!/path/to/perl

Config Variables

system('mv /home/sites/backup.site.name/web/* /temp/');

do all the tar and ftp steps there

system('mv /temp/* /home/sites/backup.site.name/web/');



This just temporarily moves the backup files of the other server out of the way while the backup is taking place.

That should do the job...

Addict
08-31-2001, 03:00 PM
I do not have 2 servers, but I would like to use this method of backing up the server. Then downloading the files to a local computer using WS_FTP_PRO.

I am trying to understand exactly what ftpbackup does.#!/usr/bin/perl

#FTP Server Information here
$ftps = "server name here";
$ftpu = "username here";
$ftpp = "password here";
$serv = "server name";

system("/bin/tar cfp - /home | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-home.tar.gz");
system("/bin/tar cfp - /etc | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-etc.tar.gz");
system("/bin/tar cfp - /var | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-var.tar.gz");
system("/bin/tar cfp - /usr/admserv | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-admserv.tar.gz");
system("/bin/tar cfp - /usr/local | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-local.tar.gz");


It appears to me (a newbie) that the script gzips the /home, /etc, /var, /usr/adminserv, and /usr/local directories.

Then it ftps those directories to your desired location.

Can I just write a shell script that gzips those directories and places them in an ftp accessable directory ->
/home/sites/home/admin/backup

Then I can use the queuing capabilities of WSFTP to download the backed up files to my local computer.

Does this make sense?

Does anyone see any problems with it? Or does ftpbackup do something else that I am missing?

Thanks for the help!!

:D

Addict

madsere
08-31-2001, 03:31 PM
First: The tar command to restor a ...gz.tar file needs to include -z option.

The -v option is "verbose". It generates a full line of text per file you backup. You might not think it worth considering but it does actually generate a lot of IO. It's not important in the restore part, but I would certainly remove it in the backup script unless you are going to redirect it to a logfile or something. A compromise could be to use -V (capital) instead which just provides a single dot per file, good for keeping tabs on the progress.

Thus the correct command should be something like:

cd /home
tar xvzf /home/sites/home/users/admin/$serv-home.tar.gz
cd /etc
tar xvzf /home/sites/home/users/admin/$serv-etc.tar.gz
cd /var
tar xvzf /home/sites/home/users/admin/$serv-var.tar.gz
cd /usr/admserv
tar xvzf /home/sites/home/users/admin/$serv-admserv.tar.gz
cd /usr/local
tar xvzf /home/sites/home/users/admin/$serv-local.tar.gz

Addict: You can in principle download these files to your PC using an FTP client -- but if you have a Raq with a 20 GB disk you want backed up daily you better consider getting some more bandwidth :-)

Consider also that most cable/adsl lines are asyncronous - i.e. while you might have 1 or 2 mbps download speed, the upload speed is often limited to 128 or 256 kbps. Try uploading 20 GB of data on 128 kbps ...

Addict
08-31-2001, 05:42 PM
madsere,

Actually, I don't use nearly all of the 20 GB. I have a few high traffic sites that I couldn't host anywhere due to bandwidth concerns. I probably have about 100 megs in just site files.

I am connected to the internet on a DSL line at 600k.

I guess I just need to know what I would need to do for disaster recovery. I have several perl scripts, PHP scripts and MySQL databases.

So would gzipping the files listed work for recovery? Do the files retain permissions? Would it just be a matter of resoring the files to a clean drive and unzipping them, or would there be more involved?

Thanks again,

Addict

webbcite
08-31-2001, 06:26 PM
check this backup method out...this seems to be the clutch backup method...uses Cobalt CMU and also hits MySQL databases as well as DNS...

http://www.dnid.de/cobalt/raqbackup/

Addict
08-31-2001, 08:25 PM
This raqbackup still seems to need 2 raq servers. I am looking for an option to backup all contants to the same server (in a tar.gz?).

I just need to know that if I take these directories and zip them up, if I can just replace them if my machine crashes (I would upload them from a local machine).

I have my WSFTP set to download all files that are placed in /home/sites/home/admin/backup on a weekly basis. Now I just need to know how I can get a complete backup into that folder.

Again, I do not have 2 servers. Just 1. I can't allow my server to ftp to my local machine because of the firewall, but I can ftp to my server from my local machine. I just need to find a way to backup the server (in a way that is easily recoverable) and leave the 'backup' file on the same machine.

I am sorry if this is not very understandable. Again, I am very new (1 week) to running my own dedicated server.

TIA

Addict

jks
08-31-2001, 09:37 PM
Hi all,

Haven't really got time to read the whole thread, but just thought I would share a few good (hopefully) advices.

I will always recommend using a combination of rsync and ssh to backups. This way you can make backups either to a remote server, or to the local server (for example on an extra harddisk).

It has a lot of advantages over tarballs:

* More secure (when transferring over networks)
* Faster (because it only transfers changes)
* Uses less bandwidth (because it only transfers changes)
* Easier to use and easier to script

When doing backups of for example MySQL, I don't think the solution in for example the raqbackup.sh script is quite adequate. Well, it works -- but it's painfully slow (and it can cause problems when you have a server where MySQL is vital -- cause the mysqldump will lock your databases for an extended period of time).

I recommend using the mysqlhotcopy perl script to do backups of MySQL databases. It has several advantages:

* The files are smaller (because it transfers the binary files over)
* It's faster (same reason)
* It locks the databases for a shorter period of time (locks per table)

When doing Postgresql you're lucky that database backups can be made so that they do not lock the database at all -- you simply take a "snapshot" of the database, and backup that (in real life, postgresql uses a neat "versioning" systems on the rows, so it does not need a big chunk of disk space for this).

Combine the above with a small perl script that initiates backups for each of your servers and email you back with the results -- and you have a great backup system!

Marty
08-31-2001, 10:10 PM
Originally posted by Addict
I just need to know that if I take these directories and zip them up, if I can just replace them if my machine crashes (I would upload them from a local machine).


Yes you can.

Addict
08-31-2001, 10:12 PM
Thank you Marty.

dutchie
09-06-2001, 06:15 AM
Brandonk i cannot find the file on the descriped server anymore, did you remove it ?

brandonk
09-06-2001, 07:39 PM
Originally posted by dutchie
Brandonk i cannot find the file on the descriped server anymore, did you remove it ?

No, I have not removed it. That is not my server so I really have no control over that link. But I just tested it and it came in fine... Should anyone ever notice that it has been removed, I will upload the file to my own servers and update the link. But right now, that link works fine.

AmericanBizTech
09-09-2001, 09:41 AM
I guess you guys will just have to guess how we do backups with a NASRAQ........ sure wish someone would contact me about buying advertising here, been trying for over a week to get information about it.

:rolleyes:

-Edward-
09-17-2001, 09:26 PM
Since ive heard nothing bad of this back-up system i think im going to give it a shot. Some really basic questions though just so i dont make no whoopsies :)

This would work with the backup account i use at tera-byte? (1b backup space for $1 :D). If the server name at tera-byte is slapandtickle.tera-byte.com i put that as the serveradmin or my machines ip address since i havent named my machine?

$ftps = "server name here"; < - this bit confusses me
$ftpu = "username here";
$ftpp = "password here";
$serv = "server name"; < - and this bit

I feel like a cobalt newbie again hehe :blush:

dico
09-19-2001, 08:33 AM
Hi there,

I am relatively new to all this, so please excuse my ignorance.

I am trying to implement the backup system that people have been discussing in this forum.

Here is what I have (a limited backup):

#!/usr/bin/perl

#FTP Server Info HERE
$ftps = "mp.ip.address.here";
$ftpu = "username";
$ftpp = "password";
$serv = "anythinghere";

system("/bin/tar cfp - /home/sites/site60 | gzip |
/usr/local/bin/ftpbackup -h $ftps -u
$ftpu -p $ftpp -b $serv-home.tar.gz");

When I run the above by typing . backup.pl I get the following:

[root ftpbackup-2.1]# . backup.pl
sh: =: command not found
sh: =: command not found
sh: =: command not found
sh: =: command not found
sh: syntax error near unexpected token `$serv-home.tar.gz")'
sh: backup.pl: line 11: `$ftpu -p $ftpp -b $serv-home.tar.gz");'
[root ftpbackup-2.1]#

I'd appreciate any help.

Thanks in advance,

-dr

brandonk
09-19-2001, 10:10 PM
Try typing "perl backup.pl" to run it.

dutchie
09-23-2001, 09:55 AM
wget http://netsw.org/net/ip/filetrans/f...ckup-2.1.tar.gz
--08:48:36-- http://netsw.org:80/net/ip/filetrans/f...ckup-2.1.tar.gz
=> `f...ckup-2.1.tar.gz'
Connecting to netsw.org:80... connected!
HTTP request sent, awaiting response... 404 Not Found
08:48:36 ERROR 404: Not Found.



What do i do wrong ?

brandonk
09-23-2001, 11:29 AM
Originally posted by dutchie
wget http://netsw.org/net/ip/filetrans/f...ckup-2.1.tar.gz
--08:48:36-- http://netsw.org:80/net/ip/filetrans/f...ckup-2.1.tar.gz
=> `f...ckup-2.1.tar.gz'
Connecting to netsw.org:80... connected!
HTTP request sent, awaiting response... 404 Not Found
08:48:36 ERROR 404: Not Found.

What do i do wrong ?

You need to get the full URL, unforunately WHT's board shortens the URL, and I tried to get it to be the full length but it wouldn't allow it. So either view the source of this thread and get the real url, or click on it and then when the window pops up, write it down. Then use that url (full url) with wget and it will work.

dutchie
09-23-2001, 12:45 PM
Ahhh...

That solves it, thanks !

korporal
10-05-2001, 06:56 AM
Hi

I`ve been having some problems with getting this backupsolution to work. The error is probably when I write in
#!/usr/bin/perl

#FTP Server Information here
$ftps = "server name here";
$ftpu = "username here";
$ftpp = "password here";
$serv = "server name";

system("/bin/tar cfp - /home | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-home.tar.gz");
system("/bin/tar cfp - /etc | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-etc.tar.gz");
system("/bin/tar cfp - /var | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-var.tar.gz");
system("/bin/tar cfp - /usr/admserv | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-admserv.tar.gz");
system("/bin/tar cfp - /usr/local | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-local.tar.gz");

I have tried this two times. Is this a problem. How can I delete them and start all over again?
And when I write in f.ex. "server name here"; shall I remove "?
Can I write in a virtual site like f.ex bekkhus.com/backup in the field "server name here". Username and password shall then be the admin username and password for this virtual site or what? And "server name"; can be anything I descide? Am I right?

Hope you can help me because this isnt my strong side and I get nervous when I cant take backup.....

ukhost
10-15-2001, 07:18 AM
*** just read the whole thread and have found the answer!!***

HiYa,

I have been trying to follow this walkthrough but when i enter:

wget http://netsw.org/net/ip/filetrans/f...ckup-2.1.tar.gz

from root, i get this:

Connecting to netsw.org:80... connected!
HTTP request sent, awaiting response... 404 Not Found
23:21:15 ERROR 404: Not Found.

Has the file been moved? any ideas??

dico
10-15-2001, 10:15 AM
Here is my backup script which works like a charm. It also backs up a list of all the domains you have hosted as well as a list of all the user accounts.



#!/usr/bin/perl

#FTP Server Info HERE
$ftps = "122.133.144.155"; #your backup computer IP address
$ftpu = "username";
$ftpp = "password";
$serv = `/bin/date +%Y-%m-%d`;
chomp($serv);

sub Backup {
my ($Directory, $Name)=@_;
$Command= "/bin/tar zcfp - $Directory | /usr/local/bin/ftpbackup "
. "-h $ftps -u $ftpu -p $ftpp -b $serv" . "-$Name.tgz";
# print $Command . "\n";
system($Command);
}

Backup("/home", "home");
Backup("/etc", "etc");
Backup("/var", "var");
Backup("/usr/admserv", "admserv");
Backup("/usr/local", "local");
system("cat /etc/passwd |/usr/local/bin/ftpbackup -h $ftps -u $ftpu -p "
. "$ftpp -b $serv" . "-userlist");
system("ls -l /home/sites |/usr/local/bin/ftpbackup -h $ftps -u $ftpu -p "
. "$ftpp -b $serv" . "-sites");




Hope this helps.

WreckRman2
10-31-2001, 06:30 PM
Anyone know how I would add the code for this backup script to email me each time it performs the backup so that I know it was done successfully?

brandonk
10-31-2001, 09:33 PM
Originally posted by WreckRman2
Anyone know how I would add the code for this backup script to email me each time it performs the backup so that I know it was done successfully?

If you're running it as a cron job as instructed, your admin email address will receive a notification each time it's run.

WreckRman2
10-31-2001, 10:04 PM
Thanks, I didn't know that. If I run the script weekly what day does the script run? One week from installation or automatically on Sunday or what?

WreckRman2
11-08-2001, 02:21 PM
What to do if cron job isn't working? I added this script to my cron.weekly 9 days ago and it still hasn't ran the script. Any ideas to why this isn't running on its own?

Thanks

Mivo
11-17-2001, 06:51 PM
Ftpbackup is a nice program. I've got one problem though: I can't use the TAR -u (update only new files option) because the -u option is already being used by the ftpbackup user option. Anyone who have successfully use the program to use the update only option? Having this option enabled means the program would not transfer the entire backup file everytime it is run.

microsol
11-17-2001, 11:30 PM
Originally posted by WreckRman2
What to do if cron job isn't working? I added this script to my cron.weekly 9 days ago and it still hasn't ran the script. Any ideas to why this isn't running on its own?

Thanks

Do you run this cron job as root?

rsidlin
11-18-2001, 02:32 PM
Excellent. Being a newbie to Linux, can you tell me how to run this backup.pl so that I can test it instead of waiting for the scheduled time.

WreckRman2
11-18-2001, 03:58 PM
Originally posted by microsol


Do you run this cron job as root?

Yes, I believe so.

-rwxr-xr-x 1 root root 747 Oct 29 18:02 backup.pl

WreckRman2
11-18-2001, 03:59 PM
Originally posted by rsidlin
Excellent. Being a newbie to Linux, can you tell me how to run this backup.pl so that I can test it instead of waiting for the scheduled time.

at Telnet prompt

perl backup.pl

rsidlin
11-18-2001, 05:16 PM
Is says it can't find that perl script. Do you know where I can find it?

WreckRman2
11-18-2001, 09:56 PM
cd to the directory where it is then run it. it is where ever you put it...

rrsnider
04-05-2002, 08:04 PM
This is an excellent post. I have set up this backup system to run weekly and I manually ran the backup on my RAQ to ensure that it is working. Based on the output, I am not sure if I had a problem. Should I be concerned about any of these messages? Here is the output:

[root cron.weekly]# perl backup.pl
/bin/tar: Removing leading `/' from member names
/bin/tar: /home/tmp/.s.PGSQL.5432: socket ignored
/bin/tar: /home/mysql/mysql.sock: socket ignored
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from link names
/bin/tar: Removing leading `/' from member names
/bin/tar: /var/run/ndc: socket ignored
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names
[root cron.weekly]#

rrsnider
11-13-2002, 04:01 PM
This script seemed great until I needed it today. I had my system restored by Rack Shack and then I restored all of the directories that I was supposed to back up. Here is the email from my expert...

The problem is /var stores information about the state of the cobalt
server -- which patches are applied etc. Since the restored server from RS
was not at the same state as your backups, you now have information that is
not correct. I cannot re-apply patches properly because the system is out
of sync. This is the current issue with httpd -- the configuration file you
have is out of sync with the current verions of httpd -- thus causing some
problems.

Also, /usr/local contains the perl directories which house the cobalt
modules that run the entire control panel -- once again some of these are
out of sync.

I would be real careful before I rely on this backup method. It may be fine with some modifications, but you can't blindly restore all of the mentioned directories.

cyrusTvirus
11-15-2002, 09:45 AM
It doenst mean i have entire knowledge... |But it seems you are god to me.

cbtrussell
11-15-2002, 02:11 PM
.

cyrusTvirus
11-16-2002, 06:40 AM
see above

cbtrussell
11-16-2002, 10:12 AM
You're right, should've sent that to you via PM. :)

MaB
11-17-2002, 11:47 PM
Wont FTP not transfer files larger than 3G?

WreckRman2
01-09-2003, 02:23 PM
Update:

Just FYI, I've been using this backup script for several months as you can tell from my earlier posts. Anyway last week my Raq3 was hacked and killed. Tera-byte set me up with a new Raq4 and while I didn't do the restore process because different machines (Raq3 to Raq4) it did have all the needed files to manually restore my websites on the newer Raq4.

Good thing this post is still here because I wanted to install in own my new server.

Thanks to whom ever posted this information because it surely saved me hundreds of hours of work.

cgisupp
01-09-2003, 07:49 PM
Here is a script that I wrote to backup sites individually, so you aren't moving 3 gig tar balls, or need to restore a smaller number of sites. I use it in conjunction with ftpbackup and it works fine.

Excuse my lousy programming!
I'm hoping a more experienced programmer will make some improvements :stickout:


#!/usr/bin/perl

# untitled2.cgi

$ip="";
$user="";
$password="";
$remote_dir="";

$file_dir = "/home/sites";
opendir(FILES,$file_dir) || &error("Can't open the database directory!");
@files = readdir(FILES);
@sortedfiles = sort {$a cmp $b} @files;
closedir(FILES);
open (FILE2,"> /home/sites/home/users/admin/ftp.sh");
print FILE2 q~#!/bin/sh~;
print FILE2 "\n\n";
foreach $file (@sortedfiles) {
if ($file=~/^www\./ || $file=~/^site/) {

print FILE2 "/bin/tar cfp - /home/sites/$file | gzip | /usr/local/bin/ftpbackup -h $ip -u $user -p $pass -d $remote_dir -b $file.tar.gz\n";


}
}
print FILE2 "/bin/tar cfp - /etc | gzip | /usr/local/bin/ftpbackup -h $ip -u $user -p $pass -d $remote_dir -b etc.tar.gz\n";

print FILE2 "/bin/tar cfp - /var | gzip | /usr/local/bin/ftpbackup -h $ip -u $user -p $pass -d $remote_dir -b var.tar.gz\n";
print FILE2 "/bin/tar cfp - /usr/local | gzip | /usr/local/bin/ftpbackup -h $ip -u $user -p $pass -d $remote_dir -b usrlocal.tar.gz\n";

close (FILE2);

chmod (0755,"/home/sites/home/users/admin/ftp.sh");

system ("/home/sites/home/users/admin/ftp.sh");
unlink ("/home/sites/home/users/admin/ftp.sh");

Jempie
01-17-2003, 06:02 AM
I'm looking for a backup system on a RaQ550
Does FTPBackup works on a Raq550

Has anyone already installed in on a RaQ550 and what is the result?

THanks

cgisupp
01-17-2003, 06:31 AM
Jempie,
there is no reason whatsoever why it wouldn't work on a RAQ550, infact it should be fine on any Linux box

BruceT
01-17-2003, 11:45 AM
You'll just have to modify all the directories, etc, as the 550 uses entirely different setup than the previous RaQs...

BruceT
01-17-2003, 11:46 AM
Also the 550 doesn't use a PostgreSQL database to hold config info. It's in a CCE database (like Qube 3), which requires different manipulation tools to import/export data. See the Developers Guide at ftp://ftp.cobalt.sun.com/pub/developers/TechNotes/SSDK.pdf for more info.

gakkene
09-21-2004, 05:37 AM
Originally posted by brandonk


#FTP Server Information here
$ftps = "server name here";
$ftpu = "username here";
$ftpp = "password here";
$serv = "server name";

system("/bin/tar cfp - /home | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-home.tar.gz");
system("/bin/tar cfp - /etc | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-etc.tar.gz");
system("/bin/tar cfp - /var | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-var.tar.gz");
system("/bin/tar cfp - /usr/admserv | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-admserv.tar.gz");
system("/bin/tar cfp - /usr/local | gzip | /usr/local/bin/ftpbackup -h $ftps -u $ftpu -p $ftpp -b $serv-local.tar.gz");
[/I]



Hi, Thanks for a good backup solution :)

I have one problem that I hope some of you experts can help a newbi with.

When the cron job is finished I only get 4 files, and the following error mailed:
Date: 9/21/2004 04:02:00 +0200
From: root (Cron Daemon)
To: root
Subject: Cron <root@www> run-parts /etc/cron.daily All headers
/bin/tar: Removing leading `/' from member names
/bin/tar: /home/tmp/.s.PGSQL.5432: socket ignored
write(STOR): Connection reset by peer
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names
/bin/tar: /var/run/ndc: socket ignored
/bin/tar: Removing leading `/' from member names
/bin/tar: Removing leading `/' from member names


I have abt.7GB of site data to backup, is that the problem ?

Any ideas ?