First page Back Continue Last page Graphics
Signals and the TRAP statement
Page 935 - 941 in Quigley.
Various signals can be trapped and your own script code executed instead of the system's normal code. Although there are up to 64 signals available, we will consider only a few of them:
SIGHUP (signal 1 or HUP: hang up) is issued for a remote connection when the connection is lost or terminated; it's also used to tap a daemon on the shoulder, to re-read its config files.
SIGINT (signal 2 or INT) is the keyboard interrupt signal given by Control-C.
SIGKILL (signal 9 or KILL) cannot be ignored or trapped.
SIGTERM (signal 15 or TERM) is the default signal used by kill(1) and killall(1).