Cron & crontab.

Valid HTML 4.01!


Cron is a daemon which is run every minute and has the job of running other programs at set times. These times are set by crontab files (cron tables). The system has a crontab and also users can run their own.
Use crontab -e to edit the crontab for the current user.
cron may take its name from Cronos, the ancient Greek god of time or maybe chronometer, an accurate clock. Or something completely different, this is UNIX after all!
See also the "at" command for running a one-shot command at a specific time.
 

Crontab format

Crontab examples

*****/path/to/command
12345 6 

1Minute of hour0-59
2Hour of day0-23
3Day of month1-31
4Month of year1-12
5Day of week0-6 (0=Sunday)
6Command to run
#comments start with #.
#you cannot mix comments and commands on the same line.
#force command output to be mailed to specific user
MAILTO="admin@myserver.com"
#or send all command output to the bitbucket
MAILTO=""
/5 * * * * /usr/bin/mrtg /data/mrtg/172.25.0.1.cfg --logging /var/log/mrtg.log
2 11,15 * * * /data/scripts/portprobe-0.5.pl

*/5 means run every 5 minutes
2 11,15 means run 11:02 and 15:02 every day

/
Meaning of *
1Do job every minute, 60 times per hour
2Do job every hour, 24 times per day
3Ignore this field and use field 5
4Do job every month, 12 times per year
5Ignore this field and use field 3
Asterisk in both field 3 & 5 means job is run every day
# * * * * * command to be executed
# - - - - -
# | | | | |
# | | | | +—– day of week (0 - 6) (Sunday=0)
# | | | +——- month (1 - 12)
# | | +——— day of month (1 - 31)
# | +———– hour (0 - 23)
# +————- min (0 - 59)
 

null


 


Send all output to /dev/null:- /path/to/myfile/file.pl > /dev/null 2>&1