Thursday, February 3, 2011

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

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?

  • 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>

    songdogtech : 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?
    songdogtech : 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.
    From Zypher
  • 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

0 comments:

Post a Comment