[thelist] backup plan

Ron ronr at linuxdude.com
Tue Nov 30 16:56:56 CST 2004


Hi, here's a sample of one way to do it. This crontab is used on a freebsd
system. On linux you can create a rsync.cron file in /etc/cron.daily or do
'crontab -e' as the user you want it to run as, which works the same
on either OS except for rsync being in the path on Linux but not on freebsd.
It's also possible to change crontab's path.

This is running as root since it's backing up an entire system to another
machine, which also requires setting up ssh to login in with just a key.
The example crontab is on the machine that the backups are being stored
on. The last 2 parameters would have to be different if the crontab was run
on the machine that was being backed up. Obviously, the backup machine
has to be locked down tight in either scenario.

in /etc/crontab or 'crontab -e'
10 10 * * * root /usr/local/bin/rsync -ave ssh --delete --numeric-ids 
--exclude-from=/etc/rsync.exclude --exclude 'u1/' web8:/ 
/u2/Daily/Webservers/web8
10 15 * * fri root /usr/local/bin/rsync -ave ssh --delete --numeric-ids 
--exclude-from=/etc/rsync.exclude --exclude 'u1/' web8:/ 
/u1/Weekly/Webservers/Web8

in /etc/rsync.exclude or whatever file you want to use,
proc/
dev/
tmp/
man/
ports/
X11R6/
share/
*exclude

on Linux, if you use a shell script in /etc/cron.daily, you will need to 
remove
everything left of /usr/local/bin/rsync and change the path to 
/usr/bin/rsync
and add the shebang line at the top...  #! /bin/sh

The only trick to rysnc is remembering what the trailing '/' does. It 
applies to
both the sourcefiles as well as the exclude files. Test it if you're not 
sure, and
remember it, or it can bite.
'rsync -av /some/tmp/sourcefiles /other/tmp/dir'
'rsync -av /some/tmp/soucefiles/ /other/tmp/dir'

a real good switch to know about on rsync is -x

lastly, the v switch in the crontab can result in a rather large email 
being
sent to root. So take it out if you don't want that.

ronr


Ron Dorman wrote:

> Richard Bennett wrote:
>
>> I setup an RSync server on a dedicated linux box, with hot-plugable 
>> harddisks in a RAID mirror.
>> I then run a simple shell script by cronjob each day on the machines 
>> that need backing-up (Windows/Linux servers,desktop and my laptop).
>>
> Richard, your reply post is an early Christmas present for me. I have 
> been talking to a business associate about doing something like this. 
> We have 3 Win2000 servers, 2 Linux servers, 4 Win2000Pro desktops and 
> a Linux desktop in one office. We are wanting/needing an automated and 
> centralized backup for the entire office.
>
> 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?
> Have you done anything for backing up remote machines (be great if we 
> could get the second office also)?
>
> Thanks,
> Ron D.




More information about the thelist mailing list