The system schedules are setup when the package is installed, via the creation of some special directories:
/etc/cron.d
/etc/cron.daily
/etc/cron.hourly
/etc/cron.monthly
/etc/cron.weekly
To display your file you run the following command:
crontab -l
root can view any users crontab file by adding “-u username”, for example:
crontab -u skx -l # List skx's crontab file.
- The number of minutes after the hour (0 to 59)
- The hour in military time (24 hour) format (0 to 23)
- The day of the month (1 to 31)
- The month (1 to 12)
- The day of the week(0 or 7 is Sun, or use name)
- The command to run
* * * * * Command to be executed
- - - - -
| | | | |
| | | | +----- Day of week (0-7)
| | | +------- Month (1 - 12)
| | +--------- Day of month (1 - 31)
| +----------- Hour (0 - 23)
+------------- Min (0 - 59)
To edit your crontabe file run:
crontab -e
Examples:
# Run the `something` command every hour on the hour
0 * * * * /sbin/something
# Run the `nightly` command at ten minutes past midnight every day
10 0 * * * /bin/nightly
# Run the `monday` command every monday at 2 AM
0 2 * * 1 /usr/local/bin/monday
Command scheduling with cron: link
The quick and simple editor for cron schedule expressions: link