I finally managed to find out what is wrong with the code. It turned out the ADOdb libraries are not supported on command line.
So I had the PHP files changed and it all works fine now.
Frage
I need some help with a daily cron job I am trying to schedule under ubuntu 10.10. I have added the job via crontab -e
and when I do crontab -l
, it looks ok. Path and naming are fine:
58 23 * * * /usr/bin/php -f /home/eem/cars1/cron/cronjob1.php
However, the cron does not execute. I have tried to run it manually from gnome scheduler. No success. I tired to run it manually from the console with this command, again without success:
/usr/bin/php -f /home/eem/cars1/cron/cronjob1.php
My var/log/syslog show that the file is executed but nothing changes in the website on Xampp:
May 14 06:27:57 eem-VirtualBox /usr/bin/crontab[31959]: (eem) LIST (eem)
This command: */5 * * * * echo hello
in crontab -e
executes and shows in syslog:
May 14 05:40:01 eem-VirtualBox CRON[31085]: (eem) CMD (echo hello)
May 14 05:40:01 eem-VirtualBox CRON[31084]: (CRON) info (No MTA installed, discarding output)
Below some diagnostics:
Command1: ps -C cron
Terminal:
PID TTY TIME CMD
881 ? 00:00:02 cron
var/log/syslog:
May 14 05:17:01 eem-VirtualBox CRON[31033]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Command2:: cat /etc/crontab
Terminal:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Command3: ls /usr/sbin/anacron
Terminal: /usr/sbin/anacron
Command4: grep CRON /var/log/syslog
Terminal:: This and much more:
May 14 05:09:01 eem-VirtualBox CRON[30048]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete) May 14 05:17:01 eem-VirtualBox CRON[31033]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Apologies for the long post but after struggling for several days with this I am desperate to find the problem. Hopefully, it will be helpful to other people after that.
Lösung 2
I finally managed to find out what is wrong with the code. It turned out the ADOdb libraries are not supported on command line.
So I had the PHP files changed and it all works fine now.
Andere Tipps
I read your comments, you should definitely, get it to run manually before attempting to schedule it.
Get the info from php configuration:
<?php
phpinfo()
?>
To find out installation path which php
, for the version php -v
Finally make sure the script is executable chmod +x /home/eem/cars1/cron/cronjob1.php