第13章关于守护进程的编写规则:
Call fork and have the parent exit. This does several things. First, if the daemon was started as a simple shell command, having the parent terminate makes the shell think that the command is done.
不是很理解,希望理解的帮一下~
第13章关于守护进程的编写规则:
Call fork and have the parent exit. This does several things. First, if the daemon was started as a simple shell command, having the parent terminate makes the shell think that the command is done.
不是很理解,希望理解的帮一下~
就是你在虚拟终端或者SSH里执行一个普通命令,比如vim。那个命令会一直运行着,你就看不到shell的提示符。守护进程应该是在后台运行的。所以fork一个子进程,再结束自身,shell就以为你的程序结束了,会显示提示符,也就是程序和shell(和终端)脱离了关系。