LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-24-2007, 02:30 AM   #1
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676
Blog Entries: 7

Rep: Reputation: 32
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 ?
 
Old 07-24-2007, 04:09 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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?
 
Old 07-24-2007, 04:15 AM   #3
ALInux
Member
 
Registered: Nov 2003
Location: Lebanon
Distribution: RHEL 5/CentOS 5/Debian Lenny/(K)Ubuntu Is Dead/Mandriva 10.1
Posts: 676

Original Poster
Blog Entries: 7

Rep: Reputation: 32
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job not working bittus Linux - Software 7 04-27-2009 07:39 PM
simple cron job: not working Robert0380 Linux - Software 3 06-24-2008 04:45 AM
Cron job not quite working... simba_cubs Linux - General 10 11-08-2006 06:27 AM
cron job suddenly stopped working Gisli Linux - Software 1 08-25-2005 12:03 PM
GPG cron job not working michredhat Linux - Software 1 12-07-2004 10:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration