Cron Job Not Working

rgomes

Verified User
Joined
Nov 14, 2006
Messages
11
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
 
Where do you have the cronjob? If it's in /etc/crontab you'll need a column for the user executing the command.
Code:
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.
Code:
0 1 * * * /usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php &>/var/log/cron-output
 
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
 
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
 
thks for the reply.

How can i force to run this command with crontab ?


Regards,
Rui Gomes
 
What do you mean?
Just run the command:

Code:
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.
 
exactly...

i´ve just done that and i´ve this in the file:

-bash: 0: command not found


Regards,
Rui Gomes
 
Hmm, okey, and what happends if you run the command in a terminal?
Code:
/usr/local/bin/php -q -f /home/admin/public_html/includes/autocron.php &>/home/admin/cron-output
 
ok, it looks better:

Code:
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
 
Last edited:
í´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
 
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.
 
ok,
but that´s why i´ve asked you if there anyway to force a cron command do run.


Regards,
Rui Gomes
 
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.
 
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
 
hi,

it work´s 100%.

Thank you all for the help.

Regards,
Rui Gomes
 
Back
Top