Reputation: 667
I'm working on setting up an upstart service for a python script on my centOs server. Though the script needs python 2.7 to be working. But the default python version on the server is 2.6 and I do not want to change it as I'm afraid other scripts will fail then.
I have installed python 2.7 and tested it and it works perfectly fine with my script. Though I am wondering of how I should write the .conf file to make the file execute with python 2.7. Because right now I get a "Job failed to start" message. And I beleive it might be because it's using 2.6 when executing the script.
This is my current conf file (with changed directory and file names though):
description "MY SCRIPT DESCRIPTION"
author "MY NAME"
start on runlevel [234]
stop on runlevel [0156]
chdir /home/aUser/scriptLocation
exec /home/aUser/scriptLocation/theScript.py
respawn
Upvotes: 0
Views: 1215
Reputation: 599610
You can just call the Python executable directly and pass the script as a parameter, rather than calling the script itself.
exec /path/to/my/python2.6 /home/aUser/scriptLocation/theScript.py
Upvotes: 3