Open coldfire-x opened 7 years ago
I am wondering the same...
Double fork is a technique meant to re-parent the daemon process to init. Some investigations show that it does not change its parent, as opposed to what we usually imagine a "daemon" would do.
For example, if you run the usage section of the doc, you may see:
$ ps j $(cat /tmp/test.pid)
PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
2091 21109 21109 21109 ? -1 Ss 1000 0:00 python3 daemon.py
The number under PPID is the pid of the parent process. On my computer this is the pid of systemd daemon, not init:
$ ps 2091
PID TTY STAT TIME COMMAND
2091 ? Ss 0:00 /lib/systemd/systemd --user
Strictly saying, I don't say the package is "daemonizing" the process. But thinking that it makes my script running in background is acceptable to me.
Readed lots of posts, all mention we should fork twice for daemonize a py process, why this lib dont?
@penpen