Penguin
Annotated edit history of SIGHUP version 11, including all changes. View license author blame.
Rev Author # Line
11 AristotlePagaltzis 1 !!! Signal: Hangup
1 PerryLorier 2
11 AristotlePagaltzis 3 This signal is generated by the [Kernel] when your controlling terminal goes away to the terminals ProcessGroup. Or, in simplier terms, when you close the Xterm, or hang up a modem. Since daemons run in the background and don't have a controlling terminal, they often use [SIGHUP] to signal that they should reread their configuration files. This can cause issues with some programs that work as both a daemon and an interactive program, such as fetchmail(1).
4
5 An example of a daemon that rereads its configuration file on [SIGHUP] is init(8), the first process created (which is responsible for creating all other processes, like getty for logging in). If you edit inittab(5), its configuration file, you can do
6
7 <verbatim>
2 JohnMcPherson 8 kill -HUP 1
11 AristotlePagaltzis 9 </verbatim>
10
8 NicBellamy 11 and it will re-read the config file (note that the correct way to do this is to use [telinit(8)]).
4 CraigBox 12
11 AristotlePagaltzis 13 To restart an inetd(8) service, you find its [PID] and send a [SIGHUP] to it:
14
15 <verbatim>
16 kill -HUP $inetd_pid
17 </verbatim>
18
19 You can prevent a process from recieving a [SIGHUP] signal by using the command nohup(1), for example:
5 PerryLorier 20
11 AristotlePagaltzis 21 <verbatim>
22 nohup wget http://www.example.com/ &
23 </verbatim>
5 PerryLorier 24
11 AristotlePagaltzis 25 will run wget(1) detached from the terminal, so it won't recieve a [SIGHUP] when you disconnect. This is useful if a download is so large that you want to log out instead of waiting until it is complete. (The <tt>&</tt> is [Shell] lingo to put the command into the background so that you can do something else, such as, uh, logging out.)