I wanted a solution with the following features:
- centralized management of directories to backup and schedule.
- automated backup
- minimal software on the windows PC
- open source
What I did:
Installed Deltacopy on the windows PC's. This is basically a rsync server with a GUI. I created one big "rsync-share" which is the C: drive.
On the linux fileserver (a nslu2 with a big usb disk) I wrote some small scripts.
Here is an example:
RSYNCPARMS="-avtol --stats --bwlimit=200 --delete"
chmod 600 $HOSTPASSFILE
while test 1
while ! ping -c1 -w4 $BCKHOST > /dev/null
echo "DELTACOPY -- [`date`] $BCKHOST is up" >> $BCKLOG
echo "DELTACOPY -- [`date`] starting backup on $BCKHOST" >> $BCKLOG
rsync $RSYNCPARMS --password-file=$HOSTPASSFILE rsync://$HOSTUSER@$BCKHOST$SRCDIR1 $DESTDIR/$BCKHOST 1>> $BCKLOG 2>> $BCKLOG
echo "DELTACOPY -- [`date`] backup finished" >> $BCKLOG
while ping -c1 -w5 $BCKHOST > /dev/null
echo "DELTACOPY -- [`date`] $BCKHOST is down" >> $BCKLOG
For each host you'll have to make a copy of this script.
The script waits until the PC is on the network and then starts the rsync backup. When finished it waits until it's powered off. Then the scripts starts over again. At night a second script takes care of email notification, here it is:
# usage: sendreport
DATESTAMP=`date | cut -b 1-10`
if [ ! -f $REPORT ]; then
SUBJECT="[$HOSTNAME] - MISSING backup for $1 on $DATESTAMP"
if ( `grep -q "rsync" $REPORT` || `grep -q "fail" $REPORT`); then
SUBJECT="[$HOSTNAME] - FAILED backup for $1 on $DATESTAMP"
else SUBJECT="[$HOSTNAME] - SUCCESSFUL backup for $1 on $DATESTAMP"
cat $REPORT | mail -s"$SUBJECT" $RECIPIENT
Et voila... simple and reliable.
Feel free to comment.