Linux-Noob Forums

Full Version: Crontab and general syntax
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hi all. I'm doing a Crontab assignment and I can't make out what the syntax for one of the questions is implying. Here it is:

 

1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1

 

From my textbook, I can make out the first 5 fields, but I have no idea what that command means. Does anyone know what that madness means?


the [-x /bla] that tests to see if the program has execute rights (ie +x)

 

then if it does it will run that commnad. Thats what the && says. So if the command is exe'able.. run it.

 

The next part sends all output to /dev/null so you don't get a email of output from the command its defalt is sending all stdout to /dev/null.. thats the first part.

 

the 2>&1 means send the stderr into stdout. So it'll also send the stderr to /dev/null


Just to inform you about the 'rtc' command. This command (only on Sol systems I believe) is used to adjust your 'Real Time Clock' to daylights savings (when it comes around).

 

The linux equivalent would be 'hwclock' iirc

.. much appreciated. These commands can be really intimidating for noobs.