Click here to Skip to main content
15,885,881 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I have php scripts I'm trying to execute routinely using cron.

I'm doing this by modifying the crontab file.

crontab contents:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
*/10 * * * * root /usr/bin/php /var/www/html/cron_update_statuses_one_hour.php
0 */03 * * * root /usr/bin/php /var/www/html/cron_update_statuses_three_hour.php
0 */08 * * * root /usr/bin/php /var/www/html/cron_update_statuses_eight_hour.php
0 */16 * * * root /usr/bin/php /var/www/html/cron_update_statuses_sixteen_hour.php
0 0 * * * root /usr/bin/php /var/www/html/cron_update_statuses_one_day.php



cron log:

Jul 13 00:10:01 s1 CROND[2944]: (root) CMD (cd /var/www/html/ /usr/bin/php cron_update_statuses_one_hour.php)
Jul 13 00:12:01 s1 crond[2124]: (*system*) RELOAD (/etc/crontab)
Jul 13 01:00:01 s1 CROND[2977]: (root) CMD (/usr/sbin/raid-check)
Jul 13 01:01:01 s1 CROND[2992]: (root) CMD (run-parts /etc/cron.hourly)
Jul 13 01:01:01 s1 run-parts(/etc/cron.hourly)[2992]: starting 0anacron
Jul 13 01:01:01 s1 anacron[3001]: Anacron started on 2014-07-13
Jul 13 01:01:01 s1 run-parts(/etc/cron.hourly)[3003]: finished 0anacron
Jul 13 01:01:01 s1 anacron[3001]: Jobs will be executed sequentially
Jul 13 01:01:01 s1 anacron[3001]: Normal exit (0 jobs run)
Jul 13 01:07:01 s1 crond[2124]: (*system*) RELOAD (/etc/crontab)
Jul 13 01:10:01 s1 CROND[3022]: (root) CMD (/usr/bin/php /var/www/html/cron_update_statuses_one_hour.php)
Jul 13 02:01:01 s1 CROND[3059]: (root) CMD (run-parts /etc/cron.hourly)
Jul 13 02:01:01 s1 run-parts(/etc/cron.hourly)[3059]: starting 0anacron
Jul 13 02:01:01 s1 anacron[3068]: Anacron started on 2014-07-13
Jul 13 02:01:01 s1 anacron[3068]: Jobs will be executed sequentially
Jul 13 02:01:01 s1 anacron[3068]: Normal exit (0 jobs run)
Jul 13 02:01:01 s1 run-parts(/etc/cron.hourly)[3070]: finished 0anacron
Jul 13 02:10:01 s1 CROND[3072]: (root) CMD (/usr/bin/php /var/www/html/cron_update_statuses_one_hour.php)


100% sure that php location is correct; 100% sure that cron service is running; 100% sure that the location of my scripts are correct

Also, yes I realize that my first entry is set to run that command every 10 minutes, I did this only for debugging purposes, please pretend its set to run it every hour

Please help *nix experts :D !

Thank you
Posted
Updated 12-Jul-14 22:02pm
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900