Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In RHEL6 root's account I have crontab job:

30 6 18 4 1 /sbin/init 6

It worked fine on the 18th of April and properly restarted my system, BUT it also restarted my OS at 6:30 on next Monday - 25th of April. Anyone knows why?

share|improve this question

migrated from stackoverflow.com Apr 26 '11 at 11:06

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

You want this instead:

30 6 18 4 * /sbin/init 6

The 1 you have tells it to run every Monday as well. See cron:

While normally the job is executed when the time/date specification fields all match the current time and date, there is one exception: if both "day of month" and "day of week" are restricted (not "*"), then either the "day of month" field (3) or the "day of week" field (5) must match the current day.

share|improve this answer
    
Thanks as well WhiteFang34, I missed this "either" word :) –  Marek Apr 26 '11 at 8:15
add comment

From the crontab(5) man page:

   Note: The day of a command’s execution can be specified by two fields —
   day  of  month,  and  day  of week.  If both fields are restricted (ie,
   aren’t *), the command will be run when either field matches  the  cur-
   rent time.  For example,
   "30  4  1,15 * 5" would cause a command to be run at 4:30 am on the 1st
   and 15th of each month, plus every Friday.
share|improve this answer
    
Thanks for help :) –  Marek Apr 26 '11 at 8:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.