Friday, May 25, 2012

Good explanation on linux daemon.

I was programming a daemon invoked from a python script which is also invoked from a server that fork() .py when it gets a command through TCP connection.

TCP:Message => Server:fork() => python:os.system() => daemon(c++)

However, server couldn't return the message from python script even though the binary was demonized successfully(It was a zombie proccess).

I spent a lot of time to find for this. TT. I found that the daemon inherited all file descriptors from the server via .py script.

Now everything works find after closing all fds after being fork()ed.

Useful links:
http://www.enderunix.org/docs/eng/daemon.php

No comments:

Post a Comment