The job works if set like this:

*/1 * * * * /usr/bin/php /home/test/cron/test.php

And if set to something like:

15 20 * * * /usr/bin/php /home/test/cron/test.php

it's not working.

[root@localhost mail]# uname -or
2.6.18-308.el5 GNU/Linux
[root@localhost mail]# cat /etc/*elease
#CentOS release 5.8 (Final)

I don't know if this going to help but when I do this:

[root@localhost mail]# date
 Wed Aug  5 20:54:02 KST 2015

and when an email comes the date is displayed like so:

Wed Aug  5 06:51:01 2015

which is actually one hour behind the time. The date was showing up EDT instead of KST, so I changed etc/profile but the cron job still wouldn't work.

  • 1
    first read the man page for cron. Because the second option means: at 20.15 of everyday run the job. – BitsOfNix Aug 5 '15 at 12:37
  • 1
    When/how often do you want the cronjob to take place? The cron syntax is Min Hour Day Month 'Day of Week' see en.wikipedia.org/wiki/Cron#Examples – Centimane Aug 5 '15 at 12:44
  • I want to run at noon, but since I can't wait one day to test I set to something like 5 minutes in the future. it's correct in this example i was trying to run it at 20:15 KST everyday. Do you have any ideas what maybe the problem ? – Cԃաԃ Aug 5 '15 at 12:55

Updating /etc/localtime for the system wide time zone setting might fix your problem. I guess KST stands for Korea Standard Time, so you might want to choose /usr/share/zoneinfo/Asia/Seoul for it. You can also run tzselect to know which file in /usr/share/zoneinfo to choose.

$ sudo cp /etc/localtime /etc/localtime.orig # for backup
$ sudo cp /usr/share/zoneinfo/Asia/Seoul /etc/localtime
$ date
Wed Aug  5 21:50:23 KST 2015

Then restart cron, or reboot your server.

  • Thank you very much Yaegashi ^_^. It was exactly the problem. You should go and answer dozens of other similar questions and collect the loot :). – Cԃաԃ Aug 5 '15 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.