Upstart monitoring problems in ubuntu and creating a pid -
i looking how create pid file monitoring of upstart processes in ubuntu. looked @ accepted answer in ubuntu, upstart, , creating pid monitoring , ended following code:
env program_name=myscript env base_path=/bar/ respawn limit 5 30 script ${base_path}/bin/python ${base_path}/scripts/${program_name}.py -e ${base_path}/foo.ini end script post-start script echo pid=`status myscript | egrep -oi '([0-9]+)$' | head -n1` echo $pid > /var/run/${program_name}.pid end script post-stop script rm -f /var/run/${program_name}.pid end script
there 3 problems encounter:
somehow code creates 2 processes. parent process (checked through ps -ef | grep python) shell such as:
/bin/sh -e -c ${base_path}/bin/python ${base_path}/scripts/${program_name}.py -e ${base_path}/foo.ini /bin/sh
while child process has correct substitutes:
/bar/bin/python /bar/scripts/myscript.py -e /bar/foo.ini
the pid file contains pid of parent of actual process. not child 1 actual process.
the respawn doesn't work. kill child process
kill pid
(which kills parent too, not vice versa).
Comments
Post a Comment