Читать книгу Linux Bible - Christopher Negus - Страница 187
Killing processes with kill and killall
ОглавлениеAlthough usually used for ending a running process, the kill
and killall
commands can actually be used to send any valid signal to a running process. Besides telling a process to end, a signal might tell a process to reread configuration files, pause (stop), or continue after being paused, just to name a few possibilities.
Signals are represented by both numbers and names. Signals that you might send most commonly from a command include SIGKILL
(9
), SIGTERM
(15
), and SIGHUP
(1
). The default signal is SIGTERM
, which tries to terminate a process cleanly. To kill a process immediately, you can use SIGKILL
. The SIGHUP
signal can, depending on the program, tell a process to reread its configuration files. SIGSTOP
pauses a process, while SIGCONT
continues a stopped process.
Different processes respond to different signals. Processes cannot block SIGKILL
and SIGSTOP
signals, however. Table 6.1 shows examples of some signals (enter man 7 signal to read about other available signals).
Notice that there are multiple possible signal numbers for SIGCONT
and SIGSTOP
because different numbers are used in different computer architectures. For most x86 and Power architectures, use the middle value. The first value usually works for Alpha and SPARC, while the last one is for MIPS architecture.