Online Manual

Cron Jobs
Chapter 21

Cron Jobs

Question: 
I have a cron job that needs to be set up to run a file every morning at 4:30 AM Eastern Standard Time. The file that needs to run is /home/$user/$domain-www/script_name 

Answer: 
To create a cron do the following:

~# su - $user

~# crontab -e

*/5 * * * * /home/$user/$domain-www/script_name

:wq

To view the cron you just created:

~# crontab -l

*/5 * * * * /home/$user/$domain-www/script_name

This will run a cron every 5 minutes.

~# exit
---------------------------------------------------
Explanation of field values:

* * * * * /home/$user/$domain-www/script_name
1 2 3 4 5 path to script

1 -- minute 00 - 59(top of hour 00)
2 -- hour of day 00 - 23(midnight is 00)
3 -- day of month 01 - 31 
4 -- month of year 01 - 12
5 -- day of week 00 - 06(Begins w/Sunday 00)
----------------------------------------------------

This will run the cron every 15 minutes:

05,20,35,50 * * * * /home/$user/$domain-www/script_name
1 2 3 4 5 path to script

--->Note that you need double-digits if there is no * or / 
--------------------------------------------------------------------
This will run the cron 4 times a day - midnight, 6AM, Noon, and 6PM:

* 00,06,12,18 * * * /home/$user/$domain-www/script_name
1 2 3 4 5 path to script


[HOME]