开发者

os.fork problem

开发者 https://www.devze.com 2023-03-17 08:27 出处:网络
I am working on a mission-critical program and my boss asked me to write a program that would protect this mission-critical program from being terminated for a long time. This mission-critical program

I am working on a mission-critical program and my boss asked me to write a program that would protect this mission-critical program from being terminated for a long time. This mission-critical program is written with python. And I wrote a protector program in C. But I encounter a problem when dealing with os.fork. Please see the following codes for ref开发者_Go百科erence

pid = os.fork()
if pid == 0:
    execlp(myprotector, myprotector, ......)
elif pid > 0:
    return_pid = pid

I used ps aux | grep myprotector in my terminal to list my programs. but the pid listed by ps aux is different from the pid generated in the above codes. I don't know why. There do exist a pid that corresponds the pid generated from codes above, but it is a process. Could you guys please help me with this? Thanks.


Options:

http://supervisord.org/

http://pypi.python.org/pypi/zdaemon/2.0.4

0

精彩评论

暂无评论...
验证码 换一张
取 消