0

I want to run a CRON command on certain days of the month at different times.

I have set up the CRON as indicated below:

40 8 5 12 6 php /home/username/public_html/path_to_php_script

This is supposed to run at 8:40am on 5th December I presume but it never does.

I noticed it only works when I use the common settings:

Example: */5 * * * * php /home/username/public_html/path_to_php_script

This is supposed to run every five minutes

I have read a lot of suggestions on StackOverflow and other articles including the official documentation on cPanel.net all to no avail.

Any suggestions?

Thanks in advance.

mosky001
  • 11
  • 3

2 Answers2

1

You must not set the weekday. Just any (*) day.
40 8 5 12 * php /home/username/public_html/path_to_php_script

Greg Kelesidis
  • 1,069
  • 14
  • 20
  • How can you tell if the php script run? – Greg Kelesidis Dec 05 '15 at 12:06
  • When I visit the link directly from my web browser. It works. – mosky001 Dec 06 '15 at 07:08
  • So, you shouldn't run the 'php' command, but the 'wget'. You may check this at this question http://stackoverflow.com/questions/5766772/using-wget-to-run-a-cronjob-php – Greg Kelesidis Dec 06 '15 at 08:35
  • I have also tried wget now. It works when I use the common settings (Eg: Every 5 minutes etc) but when I specify a unique time, say, 6:00PM on Sundays, it doesn't run. I tried wget, php and curl and they all showed similar results. – mosky001 Dec 06 '15 at 15:26
  • The timezone was the problem in my case. The CRON job actually works fine but the time on the server was 8 hours behind so I had to back date the time. You could also change the time on the server if you had access to the WHM. – mosky001 Jan 18 '17 at 10:37
0

The timezone was the problem in my case. The CRON job actually works fine but the time on the server was 8 hours behind so I had to back date the time.

You could also change the time on the server if you had access to the WHM.

mosky001
  • 11
  • 3