How you can add Cron Job at Cpanel?

cpanelExecute Cron Job in Cpanel using PHP script.

In cpanel the following will also work:

Execute code every minute(Server Time) using following code:
* * * * * php -q /home/serverpath/file.php

Execute code every five minute(Server Time) using following code:
*/5 * * * * php -q /home/serverpath/file.php

Execute code twice an hour(Server Time) using following code:
0,30 * * * * php -q /home/serverpath/file.php

Execute code once an hour(Server Time) using following code:
0 * * * * php -q /home/serverpath/file.php

Execute code twice a day(Server Time) using following code:
0 0,12 * * * php -q /home/serverpath/file.php

Execute code once a day12:00 AM(Server Time) morning using following code:
0 0 * * * php -q /home/serverpath/file.php

Execute code once a week(Server Time) using following code:
0 0 * * 0 php -q /home/serverpath/file.php

Execute code 1st and 15th day of month(Server Time) using following code:
0 0 1,15 * * php -q /home/serverpath/file.php

Execute code once a month(Server Time) using following code:
0 0 1 * * php -q /home/serverpath/file.php

Execute code once a year(Server Time) using following code:
0 0 1 1 * php -q /home/serverpath/file.php

Last star(*) can be used as per follows:
* – For every weekday
1-5 – For Monday through Friday
0,6 – For Saturday and Sunday
1,3,5 – For Monday, Wednesday & Friday
2,4 – For Tuesday & Thursday
0 – For Sunday
1 – For Monday
2 – For Tuesday
3 – For Wednesday
4 – For Thursday
5 – For Friday
6 – For Saturday

Tags: cpanel, cronjob, PHP,

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *