Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Completely baffled as to why Cron job is not working



>> Okay, so obviously the first assumption is that the script is probably
>> not running the command correctly. So I try running the script from
>> the command line, and it works perfectly.
> ...
> Because the environment cron is running it in is different. ...

My favourite way to get around this is to put something like this in
your crontab:
16 8 * * * /bin/bash -c "cd /path/to/script/;php my_script.php"

Running bash seems to bring in all the files that set up the
environment. If that is not enough then try also adding -l, which will
make it a login shell.

Darren


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links