On Wed, Feb 22, 2006 at 01:28:13PM -0600, Charles Howse wrote: > > 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. Are you sure the mount command exited with 0? What I'm thinking is: > mount -t nfs moe:/backup /Users/charles/mnt > /dev/null 2>&1 $? is set > echo `date` > $file > echo >> $file The two echo commands reset $?. Try saving the value: mount -t nfs moe:/backup /Users/charles/mnt > /dev/null 2>&1 ret=$? if [ "$?" -eq 0 ] ; then ... else echo `date` > $file echo >> $file echo "Mount returned" "$ret" ", exiting." >> $file ... fi > 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 -- ~`^`'~=-._.-=~'`^`'~=-._.-=~'^'~=-., \|/ (___) \|/ _,.-=~'`^` @~./'O o`\.~@ "Knowledge is Power" /__( \___/ )__\ *PPPFFBT!* -- Francis Bacon `\__`U_/' _.-=~'``'~=-._.-=~'``'~=-._.-=~'`^`'~= <____|' ^^`'~=-.,__,.-= ~'^`'~=-._.-=~'`^`'~=-._.-=~'^'~=-.,__,.-==--^'~=-.,__,.-=~'`^`