[mythtv-users] OT: out of disk space, but not really....

Eivind ekj at vestdata.no
Wed Dec 29 15:51:58 UTC 2004


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


More information about the mythtv-users mailing list