[X-Unix] Backup script help

dledger at ivdcs.demon.co.uk dledger at ivdcs.demon.co.uk
Fri Feb 24 00:44:08 PST 2006


From: Charles Howse <chowse at charter.net>
> It's working well, with the exception of a couple of things I would
like some input on.

I would simplify the whole nfs mount check and do something like (untested & written in webmail at a non-OSX site):

#!/bin/bash

## NOTE: ADD 'n' TO THE cmd OPTIONS WHEN TESTING

dc=`date +%m%d%y`
file='/Users/Charles/Documents/backup.log.'$dc'.txt'
cmd='rsync -uvrtp --delete-after'
src=/Users/Charles
dest=/Users/charles/mnt

# Is the volume mounted
if mount | grep "moe:/backup"; then
    :
else
    mount -t nfs moe:/backup $dest > /dev/null 2>&1
    rc=$?
fi

if mount | grep "moe:/backup"; then
    :
else
    echo "Backup vol not mounted and mount attempt failed with $rc" >> $file
    mail -s "Weekly Backup results" charles < $file
    exit
fi

...





More information about the X-Unix mailing list