[thelist] backup plan

Richard Bennett richard.bennett at skynet.be
Tue Nov 30 17:00:40 CST 2004


On Tuesday 30 November 2004 21:30, Ron Dorman wrote:
> Would you be willing to share details and/or scripts that you use to
> accomplish the backups?
> Any tracking and/or reporting done for completed/failed backups?
OK.
Rsync will usually be installed on the Linux machines already, just google on 
the specifics of starting the rsync server (this is where the backups are 
stored), Make sure you require a password to login (this is an option) and 
open port 873 (I think) on your firewall, but only allow access from the IP 
addresses (or range) of the machines to be backed-up.
I used the command: ssh-keygen to generate authorised keys to rsync over ssh, 
but you could do without that I think. (or google for it) (it saves you 
logging in manually each time)

Then I have the same user account on the server as on the client, and a 
folder /home/rich/backup in it.

On the client I run this script:

#!/bin/sh
rsync --stats --compress --rsh=/usr/bin/ssh --times --links --exclude "*bak" 
--exclude "*~" --exclude "*rpm*" --exclude "*tar.gz" /home/rich/Desktop/* 
myrsyncserver.com:backup/desktop

rsync --stats --compress --rsh=/usr/bin/ssh --recursive --times --links 
--exclude "*bak" --exclude "*~" --exclude "*rpm*" --exclude 
"*tar.gz" /var/www/html/* myrsyncserver.com:backup/var/www/html

rsync --stats --compress --rsh=/usr/bin/ssh --recursive --times --links 
--exclude "*bak" --exclude "*~" --exclude "*rpm*" --exclude 
"*tar.gz" /home/rich/Documents/* myrsyncserver.com:backup/documents

Those are 3 entries which will save a tree of folders inside the backup/ 
folder. I have a lot more. The --stats means you get some visual feedback, 
which you could save to a logfile. f.i. :

Number of files: 8191
Number of files transferred: 6
Total file size: 60673836 bytes
Total transferred file size: 52420 bytes
Literal data: 45021 bytes
Matched data: 7399 bytes
File list size: 155482
Total bytes written: 161998
Total bytes read: 212
wrote 161998 bytes  read 212 bytes  9269.14 bytes/sec
total size is 60673836  speedup is 374.04

It will tell you if there were errors too.
That is enough for me for reporting, I just check the logs every now and then, 
but you could email that to yourself too, or something...

That's it, more or less.
Just one tricky thing, if you su to root before running the batch file, the 
files will be saved in /root/backup on the server, instead of in the user's 
account, so you have to make sure the cronjob runs the script from the user's 
account, not root. (unless you just want to backup the whole machine of 
course.)

> Have you done anything for backing up remote machines (be great if we
> could get the second office also)?
The whole setup I explained is out on the internet, so your client pcs can be 
anywhere. If you have it all running on your network, you just start rsync 
without options, and start backing-up.

I didn't set up the windows boxes, so I'm not sure of the details there, but 
it's probably the same thing in a .bat file, triggered by pycron or 
something.

I hope I haven't made this look way to complicated... It's not that bad 
really.

Cheers,
Richard.




More information about the thelist mailing list