Python Daemon Subprocess not working at boot
I am attempting to write a python daemon that will launch at boot. The goal of the script is to receive a job from our gearman load balancing server and complete the job. I am using the python-daemon module from pypi (http://pypi.python.org/pypi/python-daemon/). The nature of the job that it is completing is converting images in the orf (olympus raw image format) to jpeg. In order to accomplish this an outside program is used, ufraw in this case. The problem comes in when I start the daemon at boot, if I launch from the shell it runs perfectly and completes the work. When it starts at boot it is unable to launch the subprocess command.
commandString = '/usr/bin/ufraw-batch --interpolation=four-color --wb=camera --compression开发者_如何学编程=100 --output="' + outfile + '" --out-type=jpg --overwrite "' + infile + '"'
args = shlex.split(commandString)
process = subprocess.Popen(args).wait()
I am not sure what I am doing wrong. Thanks for any help.
The issue is not related to python but rather related to the ubuntu init.d daemon. I assumed that the python script was being as a user turns out that it is not. To remedy the problem I added a sudo command to the init.d script and the subprocess starts successfully now.
精彩评论