Date: Sat, 3 Mar 2007 11:26:47 +0200 From: Kostas Blekos <mplekos@physics.upatras.gr> To: Robert Davison <rob_27_preston@yahoo.co.uk> Cc: freebsd-questions@freebsd.org Subject: Re: Backup Script Message-ID: <20070303092646.GA26572@pythagoras.physics.upatras.gr> In-Reply-To: <285897.32858.qm@web25012.mail.ukl.yahoo.com> References: <285897.32858.qm@web25012.mail.ukl.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Robert Davison <rob_27_preston@yahoo.co.uk> on Sat, Mar 03, 2007 (09:06 +0000) wrote: > Im trying to write a small backup script which I have put in > /etc/periodic/weekly. The script is as follows...... > > #!/bin/sh > # > #weekly backup of chosen files > # > if > then > tar -cf /dev/sa0 /var/ftp /home /etc /usr/local > echo "backing up the disks" > else > echo "There was a problem" 1>&2 > exit 1 > fi > echo "Finished at `/bin/date`." > exit > > > Now I have no experience at bash scripting as was wonderng if > someone could give me some help with the if statement. Basically im > trying to test to see if the machine knows that /dev/sa0 (my tape > drive) is accessable. If it is then it continus to the backup, if > not then it gives the error message and echos the date. > > Any help would be much appreciated. > > > You can test if it is writable by: [ -w /dev/sa0 ] eg: ----------- if [ -w /dev/sa0 ] then echo "Writable" else echo "Not writable" fi ----------- "man test" for other tests. -- Kostas Blekos <http://a.physics.upatras.gr/~mplekos/> GPGKey = 1398 1AB3 483E B2DF 3A2D 95F4 7534 E392 012E 6167
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070303092646.GA26572>