Cron job: [Errno 2] No such file or directory

cronmediatemplepython

On a Mediatemple gridserver, I'm trying to run this by a cron set in the control panel:

usr/bin/python /home/xxxxx/html/sitemap_gen.py --config=/home/xxxxx/html/config.xml

But I get the error "python: can't open file '/home/95809/html/sitemap_gen.py': [Errno 2] No such file or directory." But the files are there. MT requires the paths, and there is no difference in the error without the paths.

I can run it manually from ssh:

python sitemap_gen.py --config=config.xml

and have chmoded the script for execution.

Is there a different way to run this script that will work?

MT doesn't have direct examples of python scripts run by cron, and doesn't offer support.

Is there a way to wrap the script in another script – like a bash script – to get away from having to include the paths or invoke python, which I think might be the problem?

Best Answer

Two things i would suggest:

  1. Try to run the command manually on the command line if you have access
  2. Verify that your user has execute permissions on the file /home/xxxxx/html/sitemap_gen.py

EDIT: oh duh ... try using the full path to python so if the python executable is in /usr/bin it would be : /usr/bin/python /home/xxx/html/sitemap_gen.py <blah blah blah>