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?


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.

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

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.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy