Solaris crontab

Soldato
Joined
13 Apr 2009
Posts
6,463
Location
UK
Hi all, I have a job in a crontab on a Solaris 5.8 box:

#45 20 * * 1-5 [ -x /usr/local/bin/fullback.up ] && /usr/local/bin/fullback.up


What does the "-x" option denote? And why is the first part of the job in square brackets and then repeated again?


Cheers
 
Stuff inside square brackets relates to 'test'. Have a look at the man page for test (man test) for detailed explanations.

Basically [ -x file ] checks to see if file a) exists and b) has execute permissions and returns a boolean result.

If this test passes then the second clause (&& /usr/local/bin/fullback.up) executes it.

&& will run commands in series, but only if the first command returns successfully.

So basically the cron job is to see if fullback.up exists and has execute permission and then run it :)
 
Thanks :D I've written a new backup.sh file and will just replace this entry in the crontab, but wanted to check the purpose of the [ -x file ] first.


Thanks very much :)
 
Back
Top Bottom