Linux-Noob Forums
Crontab and general syntax - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html)
+--- Forum: How Do I? (https://www.linux-noob.com/forums/forum-60.html)
+--- Thread: Crontab and general syntax (/thread-2769.html)



Crontab and general syntax - Shock Wave - 2005-03-30


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?




Crontab and general syntax - hijinks - 2005-03-30


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




Crontab and general syntax - znx - 2005-03-31


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




Crontab and general syntax - Shock Wave - 2005-04-04

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