Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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>

share|improve this answer
    
Thanks, but I should have mentioned that I tried both already. Is there a way to wrap the script in another script - like a bash script - to get away from having to include the paths, which I think might be the problem? Does that make any sense? –  markratledge Jul 16 '10 at 14:39
    
Good point, and when I knew what to look for, MT does say that the path to python is usr/bin/python. But still the same error. Tried moving everything to root but then the sitemap_gen.py can't find the sitemap.xml.gz file, even when I put the full path in the config.xml file. –  markratledge Jul 16 '10 at 15:22

Create a dummy script (Just print somethign ) and run it via crond. Maybe crond doesn't have the necessary permissions to even read the file.

Propably your user have permissions so can execute it, but crond doesn't

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.