17

My current crontab looks like this:

00 00 * * 1-5 "/home/user/script.sh"

But it seems like it is not being triggered. All others are triggering fine except the one running at midnight.

What is the proper format for midnight? 00 00 or 00 24?

3
  • 2
    What OS do you use? There are differences between cron implementations. For example, on Debian (and other Linuxes but not all), you can use @midnight. Also, is that a typo or are your actually using home/user/script.sh not /home....
    – terdon
    Mar 27, 2014 at 1:44
  • Yes, you're correct, I fixed the path now. I'll check to see if it triggers tonight. Mar 27, 2014 at 2:30
  • OK, in that case I'm voting to close since it is unlikely to help future visitors.
    – terdon
    Mar 27, 2014 at 2:33

1 Answer 1

24

I believe 0 0 is the correct specification for midnight (no leading zeros, so in this case no double zero). From man crontab(5):

          field          allowed values
          -----          --------------
          minute         0-59
          hour           0-23
          day of month   1-31
          month          1-12 (or names, see below)
          day of week    0-7 (0 or 7 is Sun, or use names)

If this is in the system crontab (i.e. /etc/crontab), make sure the field between the time specifications and the command is the user that the command is to be executed as.

Also make sure that the path to your command is fully specified, in the $PATH, or makes sense relative to $HOME.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.