Andrew Sackville-West wrote:
On Thu, Apr 24, 2008 at 10:18:48PM +0200, Chris wrote:On Thursday 24 April 2008, Bob McGowan wrote:Chris wrote:Hello,I want to run a script to rsync local files to a NAS mounted to /mnt/music. Sometimes the NAS is not running, and I want to prevent the script from writing to the mount directory: is there any easy way to prevent this? Thanks, Cif [ -f /mnt/music/somefile ] then # run your script here. fihey, cool. I wouldn't have expected anything like this!another alternative, since it's likely that the contents of /mnt/music could change (I know mine does), why not do this. umount /mnt/music touch /mnt/music/SENTINELthen doif [ -f /mnt/music/SENTINEL ] then echo "Music share is not mounted!" exit 1; fi #run your script here the only way SENTINEL will appear is when the NAS is *not* mounted. And this protects whatever you are using as your SENTINEL from inadvertent deletion. A
That's an excellent suggestion. Way cool! -- Bob McGowan
smime.p7s
Description: S/MIME Cryptographic Signature