Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Crontab and general syntax
#1

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?

Reply
#2

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

Reply
#3

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

Reply
#4
.. much appreciated. These commands can be really intimidating for noobs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)