Search code examples
phpcron

Running CRON JOBS under CENTOS


I do not know what I am doing wrong. It appears that I cannot run crons under centos. I double checked the PHP path and the files path, they all seem ok to me.

59 23 * * 0 /usr/bin/php /home/fbk/public_html/.../pixel2life.php >> /var/log/mycron/pixel2life.log 2>&1
59 23 * * 1 /usr/bin/php /home/fbk/public_html/.../tutsplus.php >> /var/log/mycron/tutsplus.log 2>&1
59 23 * * 2 /usr/bin/php /home/fbk/public_html/.../tutorialzine.php >> /var/log/mycron/tutorialzine.log 2>&1
59 23 * * 3 /usr/bin/php /home/fbk/public_html/.../smashing.php >> /var/log/mycron/smashing.log 2>&1
59 23 * * 4 /usr/bin/php /home/fbk/public_html/.../makitweb.php >> /var/log/mycron/makitweb.log 2>&1
59 23 * * 5 /usr/bin/php /home/fbk/public_html/.../google.php >> /var/log/mycron/google.log 2>&1
59 23 * * 6 /usr/bin/php /home/fbk/public_html/.../hackr.php >> /var/log/mycron/hackr.log 2>&1
59 23 * * 0 /usr/bin/php /home/fbk/public_html/.../hackr2.php >> /var/log/mycron/hackr2.log 2>&1
59 23 * * 1 /usr/bin/php /home/fbk/public_html/.../hackr3.php >> /var/log/mycron/hackr3.log 2>&1

I also tried to create log files, but it appears that they do not get created. So, according to my cron, when creating them, I used the built in app from Webuzo not from crontab -e. I want them to run in specific days of the week from Sunday to Saturday and at 23:59.


Solution

  • First the problem with the logfiles: Often /var/log ist not writable for an ordinary user, and I guess, fbk is just an ordinary user; you should create a log directory in /home/fbk and write your logs into that directory. Maybe this already solves your problem.

    But if not, you should check the scripts by running them as user fbk on console without redirecting any output to any file. This often shows the problem in case of errors. I do not know your mentioned app; I always use crontab -e.

    Btw: I hope, the three dots are just to shorten the path!? ;-)