Crontab
From ChekMate Security Group
The use of crontab in Linux is almost vital, however many users know nothing of how it works, or what it is used for. Crontab is basically a scheduler which is used to run scripts at intervals. Possibilities of usage are
- a) logrotation
- b) backups
- c) time syncronisation
Crontab can he extremely handy, if you know how to use it ;-) Each line consisting of 6 fields separated by spaces.
Fields:
00,15,30,45 00-23/1 * * mon,tue,wed,thu,fri /root/backup_script
- minute of the hour, 00 to 59
- hour of the day, 00 to 23 (military time)
- day of the month, 1 to 31
- month of the year, 1 to 12
- day of the week, sun, mon, tue,....
- actual command to execute
- an asterisk that matches all possible values,
- a single integer that matches that exact value,
- a list of integers separated by commas (no spaces) used to match any one of the values
- two integers separated by a dash (a range) used to match any value within the range.
[edit]
Manual Edit
To edit your own crontab:
crontab -e
[edit]
Crontab Import
You can also import a crontab file (written exactly in the same form):
crontab <file>
[edit]
External Links
To experiment with crontab commands in safety, try Cron Sandbox at HxPI. Type in the schedule parameters and see when the job would be run in the coming days/weeks. www.hxpi.com/cron_sandbox.php




