Cron

From wiki
Revision as of 13:53, 8 March 2019 by Hdridder (talk | contribs)
Jump to navigation Jump to search

Timed execution of commands. The cron daemon is checking the crontab every minute to see if anything needs to be done

Format of crontab
minute hour day-of-month month day-of-week command
1-59 1-23 1-31 1-12 0-7 doit

In scheduling fields (all except the command) following applies:

  • * means each tick is matched.
  • A range is defined by a dash. E.g. 2-5 in minute -> execute command on minute 2,3,4 and 5
  • A list is defined by comma's E.g. 2,4,6 in minute -> execute command on minute 2, 4 and 6
  • For month and day-of-week also names can be used by giving the first 3 characters (case insensitive)

Example: Every Sunday at noon execute my script:
00 12 * * sun /usr/local/bin/myscript.sh

crontab -l
List the current crontab