[nzlug] File Server Cost Analysis

Michael Adams linux_mike at paradise.net.nz
Tue Mar 20 18:15:08 NZST 2007


On Tue, 20 Mar 2007 11:09:27 +1200 (NZST)
Matthew Poole wrote:

> > If the boss is working late and not due back in for a week i suppose
> > i could use putty to force a sync during the day, before i leave.
> > This opposed to a cron job which may get tangled if the backup
> > device isn't there. Can you do something like an 'if exists' wrapped
> > around the backup in the cron script?
> >
> There're a few tests you can do in bash to check for existence. -d
> checks for a directory, -f tests for a file, -e tests simply for
> existence.. So you could have a file on the backup device that's not
> writeable, so it can't be deleted, and just check to see if it's
> there. Something like if [ ! -e "/path/to/file" ]; then echo "Backup
> device not present"; exit 0; fi
> 

So flipped over it looks like.

if [-e "/path/to/file" ];
	# run backup here
	exit 0;
fi

-- 
Michael
Linux: The OS people choose without $200,000,000 of persuasion.



More information about the NZLUG mailing list