Web Hosting Talk







View Full Version : Cronjob Error


Nullified
11-17-2004, 07:22 PM
I recently setup a few cronjobs and they aren't working correctly. I did it through cpanel's cronjob feature. I get the following error in my mail:
/bin/sh: line 1: /public_html/billing/include/scripts/run_background_queue.inc.php: No such file or directory

If I edit the cronjobs and take out the / before public_html it gives me the following error:
/bin/sh: line 1: public_html/billing/include/scripts/run_background_queue.inc.php: Permission denied

These errors are the same for each cronjob (just different script names).
My crontab looks like this:

MAILTO="hlh"
0,15,30,45 0 * * * /public_html/billing/include/scripts/run_auto_enable.cron.php
0 * * * * /public_html/billing/include/scripts/run_auto_suspend.cron.php
*/15 * * * * /public_html/billing/include/scripts/run_background_queue.inc.php
0 0 * * * /public_html/billing/include/scripts/generate_invoices_daily.inc.php
10 0 * * * /public_html/billing/include/scripts/run_background_batch.inc.php

Can someone please tell me what I am doing wrong?

radv
11-17-2004, 08:09 PM
With cronjobs you will need to start from the root of the server....

ex: /usr/home/..../...../..../

I am not sure how Cpanel sets of directories so you will need to edit to your config.

Also for php scripts you may need to put this in front of your cron like so.....

/usr/local/bin/php -q -f /usr/.../..../.../public_html/....

That would be the location of php on your server.

Nullified
11-17-2004, 08:35 PM
I changed it so that /usr/local/bin/php -q -f /home/hlh/ was in the beggining of each cronjob.

Now it gave me the following error:
Warning: main(include/functions.inc.php): failed to open stream: No such file or directory in /home/hlh/public_html/billing/include/scripts/run_background_queue.inc.php on line 36
Warning: main(): Failed opening 'include/functions.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/hlh/public_html/billing/include/scripts/run_background_queue.inc.php on line 36
Fatal error: Call to undefined function: testlogin() in /home/hlh/public_html/billing/include/scripts/run_background_queue.inc.php on line 40

RevMagi
11-17-2004, 10:57 PM
Hello PiMPaRSeBiSh,

Before you put something into the cron you need to make sure the script works. SSH to the directly the script is in and just type on the command line php nameoffile.php . If you get an error your script is not configured correctly. Looking at that error system that is your software not being configured correctly not a problem of cron.

James
HQMG Management Systems

Nullified
11-17-2004, 11:34 PM
My scripts are working correctly. I haven't modified them once and they are scripts that came with the modernbill install. I have run each of them to test also. I found the error though. I wasn't putting " ../../ cron" at the end of the commands.

RevMagi
11-17-2004, 11:53 PM
ah good deal. modernbill is a wonderful program, I have many installations of it running.

Glad you found the problem.

James
HQMG Management Systems