September 20th, 2007, 11:45 PM
Cron Is Not Working
I have a complex PHP script which downloads a variable number of files.
When i schedule the Cron Job (via Cron through Webmin), the job does not sucessfully download any files (or do anything useful as far as I can tell, when the system runs it automatically.) The download portion of the script is actually a seperate program call by the master program. I structured this way so that I can create forked processes.
However, If I manually run the cron job it works fine. NOTE - I AM MAKING ZERO CHANGES TO THE PROGRAM. The Cron is scheduled to run the job as root.
SO I AM OUT OF IDEAS.
Lots of points for this one - especially if I can walk away from this not feeling stupid.
Last edited by PhackedUp; September 21st, 2007 at 12:09 AM.
September 21st, 2007, 12:30 AM
I shall award myself points for this.
AS AN FYI when you run a cron job as root, depending on how your shell works (ie it may be different to the env cron runs in), you may need to use the full path.....
for instance normally "php my_executable.php" works at my command line,...however cron requires
As result the problem was thatthe "my_executable.php" script had an exec("php download_stuff.php $input $output");
command,...which apparently cron needs the full path to the executable.
Note that php .... works even when I am not in the directoy of the executable which means its not as simple as locale.
Anyway I hope this saves someone lots of gray hairs.