View Full Version : Cron Job Not Working
rgomes
11-14-2006, 02:48 AM
hi, íīm using this command:
0 1 * * * /usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php
And itīs not working...
What íīm doing wrong ?!
Regards,
Rui Gomes
patrik
11-14-2006, 02:51 AM
Where do you have the cronjob? If it's in /etc/crontab you'll need a column for the user executing the command.
0 1 * * * root /usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php
If not (for example you have added the job with "crontab -e") try to print output to a file and see if it says anything interesting.
0 1 * * * /usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php &>/var/log/cron-output
rgomes
11-14-2006, 04:06 AM
hi,
if i make:
crontab -u admin -l
if have:
0 1 * * * /usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php
so... i think itīs ok like this ?!
But it doesnīt run.
Regards,
Rui Gomes
patrik
11-14-2006, 04:12 AM
Yes, that would be correct. And if you add
&>/var/log/cron-output at the end? You might want to change the path to anything that's writeable by the admin user, like &>/home/admin/cron-output
rgomes
11-14-2006, 04:15 AM
thks for the reply.
How can i force to run this command with crontab ?
Regards,
Rui Gomes
patrik
11-14-2006, 04:18 AM
What do you mean?
Just run the command:
0 1 * * * /usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php &>/home/admin/cron-output
And check what /home/admin/cron-output contains when the job should have been run.
rgomes
11-14-2006, 04:20 AM
exactly...
iīve just done that and iīve this in the file:
-bash: 0: command not found
Regards,
Rui Gomes
patrik
11-14-2006, 04:21 AM
Hmm, okey, and what happends if you run the command in a terminal?
/usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php &>/home/admin/cron-output
rgomes
11-14-2006, 04:24 AM
ok, it looks better:
Warning: main(../Connections/autocenter.php): failed to open stream: No such file or directory in /home/admin/domains/linuxserverbug06.net/public_html/inclu$
But all the files are there.
Iīve exactly this command with cpanel and itīs running ok. (in another server of course)
Regards,
Rui Gomes
patrik
11-14-2006, 04:31 AM
You might want to check /var/log/cron
rgomes
11-14-2006, 04:35 AM
íīve already checked and for this command íīve:
Nov 13 01:00:01 centos4364m crond[2886]: (admin) CMD (/usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php)
And no error here...
But if i run manually this file it sendīs an email and do other tasks.
Regards,
Rui Gomes
patrik
11-14-2006, 04:38 AM
Sorry, I'm currently out of ideas.
But -bash: 0: command not found sure looks like you're trying to execute "0". Try run 0 in the terminal and you'll get the same result.
rgomes
11-14-2006, 04:40 AM
ok,
but thatīs why iīve asked you if there anyway to force a cron command do run.
Regards,
Rui Gomes
Rick L.
11-14-2006, 04:54 AM
Do you have an include-tag in /home/admin/public_html/includes/autocron.php?
If you use it like this:
(../Connections/autocenter.php)
try using the full path:
(/home/admin/public_html/Connections/autocenter.php)
Otherwise the cronjob don't know where to find autocenter.php.
rgomes
11-14-2006, 05:06 AM
yes, íīve.
it seemīs a good tip.
iīve tested it and the cron-output file is empty.
Maybe...
Iīll reply after the cronjob runs.
Thank you very much for all the help.
regards,
Rui Gomes
rgomes
11-22-2006, 02:07 AM
hi,
it workīs 100%.
Thank you all for the help.
Regards,
Rui Gomes
Powered by vBulletin™ Version 4.0.4 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.