linux重啟守護進程可以使用-HUP參數來發送hang up掛斷信號,系統會重啟進程進行復位操作重新讀取配置文件
kill -HUP pid
pid 是進程標識。如果想要更改配置而不需停止並重新啟動服務,請使用該命令。在對配置文件作必要的更改后,發出該命令以動態更新服務配置。
根據約定,當您發送一個掛起信號(信號 1 或 HUP)時,大多數服務器進程(所有常用的進程)都會進行復位操作並重新加載它們的配置文件。
There are also different signals that can be sent to both kill commands. What signal you send will be determined by what results you want from the kill command. For instance, you can send the HUP (hang up) signal to the kill command, which will effectively restart the process. This is always a wise choice when you need the process to immediately restart (such as in the case of a daemon). You can get a list of all the signals that can be sent to the kill command by issuing kill -l. You’ll find quite a large number of signals
注:自己編寫服務無法使用kill -HUP
-HUP無法生效參考:
https://docs.oracle.com/cd/E19253-01/819-7842/fhkpa/index.html