[X-Unix] Backup script help

Charles Howse chowse at charter.net
Wed Feb 22 11:28:13 PST 2006


On Feb 22, 2006, at 1:08 PM, Brian Medley wrote:

> On Wed, Feb 22, 2006 at 12:21:45PM -0600, Charles Howse wrote:
>
>> First, I'm not satisfied with how I'm verifying that the backup
>> volume on the remote server is mounted or not.  Can anyone help
>> make  that section 'bullet-proof'?
>
> What are you not satisfied with?

Sorry I didn't make this clear initially.
This part sometimes errors with "mount returned 0, exiting" which  
means the volume was mounted successfully.  I added the 'not'  
operator, but IMO, there should be a more elegant way to do this  
entire section.

else
		# Volume is not mounted, mount it and continue
		mount -t nfs moe:/backup /Users/charles/mnt > /dev/null 2>&1
		if [ "$?" -eq 0 ] ; then
			# Mounted OK
			echo `date` > $file
			echo >> $file
			echo "Mounted volume successfully, continuing." >> $file
			echo >> $file
		else	
			# Mount failed
			if [ "$?" ! -eq 0 ] ; then
				echo `date` > $file
				echo >> $file
				echo "Mount returned" "$?" ", exiting." >> $file
				mail -s "Weekly Backup results" charles < $file


More information about the X-Unix mailing list