本文介绍了SIGHUP用于重新加载配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 signal(7) SIGHUP 用于检测控制终端上的挂机或控制进程的死亡。

According to signal(7), SIGHUP is used to detect hangup on controlling terminal or death of controlling process.

但是,我遇到了很多OSS守护程序(服务),其中 SIGHUP 用于启动重新加载配置。以下是一些示例: hostapd sshd snort 等等。

However, I have come across a lot of OSS daemons(services) where SIGHUP is used to initiate a reload of configuration. Here are a few examples: hostapd, sshd, snort etc.

这是实现重新加载的标准(或普遍接受的)方法吗?如果不是,那么建议什么?

Is this a standard(or a generally acceptable) way to implement a reload? If not, whats recommended?

推荐答案

SIGHUP,因为有关终端关闭事件的通知对于守护程序没有意义,因为恶魔从终端分离。因此系统将永远不会将信号发送给他们。
然后,守护程序通常将其用于其他含义,通常是重新加载守护程序的配置。
这不是一条规则,只是一种约定。这就是为什么手册页中没有记录它的原因。

SIGHUP as a notification about terminal closing event doesn't make sense for a daemon, because deamons are detached from their terminal. So the system will never send this signal to them.Then it is common practice for daemons to use it for another meaning, typically reloading the daemon's configuration.This is not a rule, just kind of a convention. That's why it's not documented in the manpage.

请参见Wikipedia条目,以获取
,然后从此处

See the wikipedia entry for SIGHUPand from there, a longer description with implementation example

这篇关于SIGHUP用于重新加载配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-13 20:55