Signals

 < Day Day Up > 

When you issue the kill command and process number, you are also sending a default signal associated with the kill. You did not specify a signal in the kill example. That means that the default signal of 15, or SIGTERM, was used. These signals are used by the system to communicate with processes. The signal of 15 you used to terminate the process is a software termination signal that is usually enough to terminate a user process such as the find you started. A process that is difficult to kill may require the SIGKILL, or 9 signal. This signal causes an immediate termination of the process. I use this only as a last resort because processes killed with SIGKILL do not always terminate smoothly. To kill such processes as the shell, you sometimes have to use SIGKILL.

You can use either the signal name or number. These signal numbers sometimes vary from system to system, so view the manual page for signal in manual page section 7 to see the list of signals on your system. A list of some of the most frequently used signal numbers and corresponding signals follows:

 Signal      Value     Action   Comment ------------------------------------------------------------------------- SIGHUP        1       Term    Hangup detected on controlling terminal                                or death of controlling process SIGINT         2       Term    Interrupt from keyboard SIGQUIT        3       Core    Quit from keyboard SIGILL         4       Core    Illegal Instruction SIGABRT        6       Core    Abort signal from abort(3) SIGFPE         8       Core    Floating point exception SIGKILL        9       Term    Kill signal SIGSEGV       11       Core    Invalid memory reference SIGPIPE       13      Term   Broken pipe: write to pipe with no readers SIGALRM       14       Term    Timer signal from alarm(2) SIGTERM       15       Term    Termination signal SIGUSR1    30,10,16    Term    User-defined signal 1 SIGUSR2    31,12,17    Term    User-defined signal 2 SIGCHLD    20,17,18    Ign     Child stopped or terminated SIGCONT    19,18,25            Continue if stopped SIGSTOP    17,19,23    Stop    Stop process SIGTSTP    18,20,24    Stop    Stop typed at tty SIGTTIN    21,21,26    Stop    tty input for background process SIGTTOU    22,22,27    Stop    tty output for background process 

Note that you can get the online manual page for a command by issuing man command_name. You can view an online manual page from a specific section by specifying the section number. To view the signal man page in section 7, issue the following command:

 # man 7 signal 

This produces the signal(7) man page. If you were to type just man signal the signal(2) man page would be produced; that is, the man page for signal in section 2 would be shown.

To kill a process with id 234 with SIGKILL, issue the following command:

 # kill -9 234     |   |  |     |   |  |> process id (PID)     |   |> signal number     |> kill command to terminate the process 

Keep in mind that the signal definitions may differ among Linux variants.

     < Day Day Up > 


    Linux on HP Integrity Servers. A System Administrator's Guide
    Linux on HP Integrity Servers: A System Administrators Guide
    ISBN: 0131400002
    EAN: 2147483647
    Year: 2004
    Pages: 100

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net