PDA

View Full Version : Cron job help


zfade3
10-31-2006, 12:58 PM
Hi All,

I'm trying to set up a cron job that will run a script from a particular directory. For example, if I log in to the ssh, I can:

cd /home/myusername/path/
python script.py param.ini

and it runs fine. I need this to run every hour, but the 'python script.py param.ini' has to be run from the right directory.

How would I go about doing that?

Thanks for your help!

xtendedf
10-31-2006, 01:27 PM
Hi All,

I'm trying to set up a cron job that will run a script from a particular directory. For example, if I log in to the ssh, I can:

cd /home/myusername/path/
python script.py param.ini

and it runs fine. I need this to run every hour, but the 'python script.py param.ini' has to be run from the right directory.

How would I go about doing that?

Thanks for your help!

code a shell script and insert:
cd /home/myusername/path/
python script.py param.ini

now run the thing in cron.

shadmego
11-01-2006, 11:01 AM
You can also set up cron jobs through CPanel. There is a standard and advanced section. If you don't know how to set up a cron job in the command line, use the standard method as it provides tables with options. In the path, just point the target to the script you want to run. Make sure you give the script enough time to fully run its course.

If you set up a cron job for your script for every 15 minutes, but the script takes 20 minutes to complete, it will backlog and start hogging system resources. You account will be suspended if this happens until you fix the problem.

Sign onto CPanel and under the Advanced Menu (near the bottom) select Cron jobs. On the next page click Standard and you will be on your way.

Kindest Regards,
Shadmego