Page 1 of 1

cron problem

Posted: Fri Feb 29, 2008 10:39 am
by dannyd
My cron works on the command line but not as a crontab.

How can I get it working as a crontab ?

Re: cron problem

Posted: Fri Feb 29, 2008 11:09 am
by Mightywayne
Erm, which OS are you using? For example in Plesk, you just go to the cron tab and deselect the command line option.

Re: cron problem

Posted: Fri Feb 29, 2008 11:24 am
by dannyd
Fedora Core 4.

Re: cron problem

Posted: Fri Feb 29, 2008 12:51 pm
by Zoxive
How are you executing it in command line & crontab?

Are you using shebang? Or Full path to php?

Re: cron problem

Posted: Fri Feb 29, 2008 1:01 pm
by dannyd
Im using this at the top of the script:

#!/usr/local/bin/php -q


And this line to execute on the command line:

php -a ./logs

Re: cron problem

Posted: Fri Feb 29, 2008 1:13 pm
by dannyd
theres other cron scripts working before I started fine.

Not sure exactly why mine only works on the command line and not using crontab.

Re: cron problem

Posted: Mon Mar 03, 2008 9:44 am
by dannyd
when I run the cron on the command line it works fine .. but it also says Interactive mode enabled when I run it:

[root@web1 cron]# php -a ./logs
Interactive mode enabled

Processing the following files:<BR>080203log.txt


It doesnt work as a crontab. My crontab entry is fine to run at 10:20am.

20 10 * * * /usr/local/cron/logs

Re: cron problem

Posted: Mon Mar 03, 2008 11:11 am
by Mightywayne
Your host will more than likely know how to help you.

Re: cron problem

Posted: Tue Mar 04, 2008 8:16 am
by dannyd
I dont have a host. Im on my own managed server.

Re: cron problem

Posted: Thu Mar 06, 2008 11:28 am
by dannyd
Mar 6 11:57:01 intranet crond[2286]: (tmp.XXXXGHJVjz) ORPHAN (no passwd entry)
Mar 6 11:57:01 intranet crond[2286]: (root) RELOAD (cron/root)
Mar 6 11:57:01 intranet crond[2286]: (tmp.XXXXFqiL6E) ORPHAN (no passwd entry)

Anyone know what this means.

This is the error I get in my cron log file. I suspect its not running the file as root which it is supposed to. How can I set the user to run the cron job ?

Let me know if im wrong.

Re: cron problem

Posted: Thu Mar 06, 2008 12:57 pm
by dannyd
Figured it out:

1. 20 10 * * * /usr/local/bin/php -a /usr/local/cron/logs
2. restart crond