Penguin
Note: You are viewing an old revision of this page. View the current version.

Signal: Hangup

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). An example of a daemon that rereads it's 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 /etc/inittab, its configuration file, you can do

kill -HUP 1

and it will re-read the config file (note that the correct way to do this is to use telinit?).

To restart an inetd(8) service, you send a hangup to inetd
killall -HUP inetd

You can prevent a process from recieving a SIGHUP signal by using the command nohup(1)

For example
nohup wget http://www.example.com/ &

will run "wget" that is not attached to a terminal (and therefore doesn't recieve a SIGHUP) when you disconnect. This is useful if the file you are downloading is long, but you want to logout before the download is complete. The "&" at the end is used to put the command into the background.