• Root/
  • Linux/
  • Signals
  • Signals are used to interrupt and/or influence execution of programs, either by users or system.

    To send a signal to program, you need to know its PID and SIGNAL you wish to send.

    ps -aux or systemd-cgls are useful for determining the PID. Once decided, kill --signal SIGNAL PID can be used to send selected signal to process.

    Actions

    Table of signals

    ID Name Default action Description POSIX?
    1 SIGHUP Terminate Closes terminal or process True
    2 SIGINT Terminate Keyboard interrupt, Control-C True
    3 SIGQUIT Dump Quit True
    4 SIGILL Dump Illegal instruction True
    5 SIGTRAP Dump Trace/breakpoint trap False
    6 SIGABRT Dump Aborted True
    6 SIGIOT Dump SIGABRT equivalent False
    7 SIGBUS Dump Bus error False
    8 SIGFPE Dump Floating point exception True
    9 SIGKILL Terminate Killed True
    10 SIGUSR1 Terminate User defined signal 1 True
    11 SIGSEGV Dump Segmentation fault True
    12 SIGUSR2 Terminate User defined signal 2 True
    13 SIGPIPE Terminate Broken pipe True
    14 SIGALRM Terminate Alarm clock True
    15 SIGTERM Terminate Terminated True
    16 SIGSTKFLT Terminate Stack fault False
    17 SIGCHLD Ignore Child exited True
    18 SIGCONT Continue Continued True
    19 SIGSTOP Stop Stopped (signal) True
    20 SIGSTP Stop Stopped True
    21 SIGTIN Stop Stopped (TTY input) True
    22 SIGTOU Stop Stopped (TTY output) True
    23 SIGURG Ignore Urgent I/O condition False
    24 SIGXCPU Dump CPU time limit exceeded False
    25 SIGXFSZ Dump File size limit exceeded False
    26 SIGVALRM Terminate Virtual timer False
    27 SIGPROF Terminate Profiler timer False
    28 SIGWINCH Ignore Window change False
    29 SIGIO Terminate I/O possible False
    29 SIGPOLL Terminate SIGIO equivalent False
    30 SIGPWR Terminate Power failure False
    31 SIGSYS Dump Bad system call False
    31 SIGUNUSED Dump SIGSYS equivalent False

    Specific signals

    Signal 9 - SIGKILL

    Cannot be caught, blocker or ignored. Typically signals for immediate termination of a process. Default signal sent to container's process by Docker.

    Signal 10 - SIGUSR1

    First of two custom signals left available to be handled by programmer.

    Signal 12 - SIGUSR2

    Second of two custom signals left available to be handled by programmer.

    Signal 15 - SIGTERM

    Typically signals for controlled termination of a process. Default signal sent to container's process by Kubernetes - at first (later followed by SIGKILL, if container fails to exit in set time limit).

    Signal 19 - SIGSTOP

    Cannot be caught, blocker or ignored. Stops execution of thread.