On Wednesday 29 December 2004 15:07, James Pifer wrote: > I need to figure out how to tell my script to only rsync the files if > the mount worked correctly. Anyone know how to do that? My script is > simply: > > mount 192.168.1.22:/storage /mnt/storage > rsync -av --delete --exclude=nice_names /mythtv/recordings > /mnt/storage/mythtv > rsync -av --delete /mythtv/music /mnt/storage/mythtv > rsync -av --delete /mythvideos /mnt/storage/mythtv > umount /mnt/storage
Simple. mount returns an exit-code indicating success or failure (as does most unix-commands. Thus modify your script as following: ---------------------------------- if mount 192.168.1.22:/storage /mnt/storage then rsync -av --delete --exclude=nice_names \ /mythtv/recordings /mnt/storage/mythtv rsync -av --delete /mythtv/music /mnt/storage/mythtv rsync -av --delete /mythvideos /mnt/storage/mythtv umount /mnt/storage else echo "Alert -- Mounting of NFS-server failed !" fi ------------------------------------- The other suggestions you got, running "mount" and trying to parse the output and suchlike will also work. But why make it complicated ? Eivind Kjørstad _______________________________________________ mythtv-users mailing list mythtv-users@mythtv.org http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users