Server level cron jobs
/etc/crontab – The basic server level crontab file for hourly/monthly/weekly jobs. It read from below directories
/etc/cron.hourly
/etc/cron.daily
/etc/cron.weekly
/etc/cron.monthly
One can put the script files in above directories for daily/weekly/monthly jobs.
User level cron jobs
Physical location of cron files, (Dont Edit directly).
/var/spool/cron/crontabs/<user> (Redhat – Debian – FC)
/var/spool/cron/ (Mandrake)
To create a cron schedule user can type:
crontab -e
Just save and exit. Look for errors.
Cron Job Format
MINTE HOUR DAY MONTH DAYOFTHEWEEK COMMAND
Examples:
0 * * * * /home/kira/cronns/cmd1.pl
This will execute each hour (*:00), every day
30 6 * * * /home/kira/cronns/cmd1.pl
This will execute each (6:30 AM), every day
0 22 * * 1-5 /home/kira/cronns/cmd1.pl
Runs at 10 pm on weekdays
23 0-23/2 * * * /home/kira/cronns/cmd1.pl
Runs 23 minutes after midn, 2am, 4am …, everyday
0/1 * * * * /home/kira/cronns/cmd1.pl
This will execute each minute every day
0/2 * * * * /home/kira/cronns/cmd1.pl
This will execute every 2 minutes every day
0/30 * * * * /home/kira/cronns/cmd1.pl
This will execute every 30 minutes every day
Sign up for our daily email newsletter:
You must log in to post a comment.