LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Cron Job Not Working... (https://www.linuxquestions.org/questions/linux-software-2/cron-job-not-working-571809/)

ALInux 07-24-2007 02:30 AM

Cron Job Not Working...
 
Hi All
I have setup a cronjob to run every minute..it is a php script and all it does is that it writes a random (for testing only untill it works) number into a file.
I did crontab -e and added
* * * * * /usr/local/bin/php -q /www/htdocs/cacti/scripts/logins_per_hour.php
then I did /etc/init.d/crond restart
I receive email in my root mailbox every minute from the cron deamon stating that everything went fine. However when I do check the output file it always contains the same number as if the command was not executed.
If I execute php -q /www/htdocs/cacti/scripts/logins_per_hour.php it writes a new number into the file.
Both the php script and the logins file are 777 (also for testing purposes)
The log files do not contain any mentionable errors.

Can anyone guide me into the right direction ?

jschiwal 07-24-2007 04:09 AM

Does the timestamp on the file indicate that the cron wrote the same number or that the file isn't being modified?. Does your script also produce console output or expect console input? Try also redirecting stderr to a file and see if there were any errors or other stderr output.

Does the environment of the cron job differ such that it can't run a php script?

ALInux 07-24-2007 04:15 AM

I actually did solve it..the php file in question writes output to a file as mentioned initially..that file is refered to in the php file as ./filename, that used to work when I developed php apps for apache servers..in this particular case I had to change to the full path name and it worked fine..i.e /path/to/file/filename in the php file.
Thanks for your assistance


All times are GMT -5. The time now is 07:25 PM.