2

What happens if I use '*' for the minutes value? Is the command going to be run every minute? For example: * 4 * * 0 <command>

6

Yes, in your example, the command will run every minute of the 0400 hour on every Sunday.

By the way, if you do need something to run every minute, it's likely that you're monitoring something for changes; there is typically a better way of doing this. For instance, on Linux there is inotify for waking programs based on filesystem events, and ip monitor for watching network status changes.

2

Yes this will run every minute of the fifth hour (0400 to 0459) on Sunday. Likely what is intended is to run once during that period. Unless it needs to run on the hour, pick a random value from 1 to 59, and replace the minutes value.

If you have a bunch of programs that need to run in a particular period, you can limit load peaks by using a random minute in the hour you want the task to run. Use a different value for each crontab entry.

1

Yes, this job will run every minute.

Here are some relevant sections from man 5 crontab:

   cron(8) examines cron entries once every minute.  The time and date fields are:

          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)

   A field may be an asterisk (*), which always stands for ``first-last''.

The manpage says that if you use the asterisk (*) in the minute field, this is is equivalent to using "0-59" (``first-last''), and the job will run every minute in the hour.

Your Answer

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

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