SIGHUP for reloading configuration

HAL picture HAL · Sep 27, 2013 · Viewed 21.7k times · Source

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

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?

Answer

Little Jawa picture Little Jawa · Feb 4, 2015

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.

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