Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Apr 26 '11 at 11:06

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

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

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

You must log in to answer this question.