Cron How to
- Chris Speed
- Feb 23, 2017
- 1 min read
To edit cron jobs list - crontab -e
To display cron jobs list - crontab -l
Default Directory - /var/spool/cron/crontabs
Each line has five time-and-date fields, followed by a command, followed by a newline character ('\n').
The fields are separated by spaces.
The five time-and-date fields cannot contain spaces.
The five time-and-date fields are as follows: minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday).
Examples:
01 04 1 1 1 /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on January 1st plus every Monday in January.
An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used.
01 04 * * * /usr/bin/somedirectory/somecommand
The above example will run /usr/bin/somedirectory/somecommand at 4:01am on every day of every month.
Comments