How to set up a crontab...

Alright, so I have a script I want to run on crontab. It's a commercial script I purchased and the documentation says to put this on cron if I want it to run automatically each day:

/usr/local/bin/php /home/dangro/public_html/[program]/[program].php

I have no problem editing crontabs, I added that, fine. But I realized after two days it wasn't running, and when I execute that commend manually I see that it fails with an error about opening a file.

I realized that if I cd into the [program.php]'s directory and run the command there it's fine. If it's run from any other directory it can't find the files it's looking for.

So what is the proper method of remedying this? How do I specify what directory to run the command from on cron? Do I need to make a script which cd's there before running it (will that work?)?

Thanks,
Dan

 

 

 

 

Top