Cron Tutorial - Advanced Usage
The below cron usage information is optional and is intended for more advanced users.
1. Crontab Editing
Usually, a user would edit a file containing crontab entries and
load the file after making changes.
machine:~$ crontab myfile
|
|
It is also possible to directly edit the actual crontab file used by the
cron daemon.
Specifying the -e option will launch the default editor (usally vi)
to modify the actual crontab file. After the user exists the editor, the
crontab file is updated.
2. Advanced Formatting
The first part of this cron tutorial deals with the basic crontab format. Slightly more advanced options exist.
59 17 1,10,20,30 * * /home/username/backupsite
|
|
This would execute the ask on the 1st, the 10th, the 20th and on the 30th of each month, at 17:59PM.
59 17 * * 1-5 /home/username/backupsite
|
|
This would execute the cron job on weekdays only.
59 */6 * * * /home/username/backupsite
|
|
Here, the tasks is executed every 4 hours (24/6 =4).
These techniques can be used on all the crontab fields.