Home Wiki > SDB:UNIX software signals
Sign up | Login

SDB:UNIX software signals

tagline: From openSUSE

Purpose of this article

The purpose of this article is to inform users and system administrators about how signals are used on openSUSE and/or serve as a reference to advanced users. This article will focus on signals that can be used by the user to achieve a useful result. This means that signals issued by the kernel, such as SIGILL, will not be covered here.

Signals

The following signals are described in this article:

SIGTERM

Signal in a nutshell:

Signal number: 15

Purpose: Ask a process to terminate

When SIGTERM is sent to a process, it is requested to close all open files, initiate its termination sequence, and finally terminate itself. SIGTERM can be handled by processes in a different than standard way (signal trap). For example, a process can completely ignore the signal or request user confirmation.

SIGKILL

Signal in a nutshell:

Signal number: 9

Purpose: Forcibly terminate a process

SIGKILL works the same as SIGTERM, but it cannot be handled by processes and does not allow the process which is being signaled to prepare and/or close it's open files, so it can be very useful if a process is malfunctioning or crashed.

SIGINT

Signal in a nutshell:

Signal number: 2 Purpose: Interrupt the current operation of a process.

Notes: Invoked by pressing Control+C

SIGINT is sent when the user wants the process being signaled to interrupt its current operation. This signal is sent when the user presses Control+C.

SIGSTOP

Signal in a nutshell:

Signal number: 19

Purpose: Pause the execution for future resumption.

SIGSTOP is sent to a process when the user wants the process being signaled to be stopped for future resumption. Unlike its "more friendly" counterpart SIGTSTP, SIGSTOP cannot be trapped.

SIGTSTP

Signal in a nutshell:

Signal number: 20

Purpose: Works almost exactly like SIGSTOP, but can be trapped.

SIGTSTP is the friendly counterpart of SIGSTOP. Like SIGSTOP, it pauses the execution of a process for further resumption, but unlike SIGSTOP, it allows the process to set a handle (trap) for it. It is automatically invoked by pressing Control + Z.

Note: Processes stopped by SIGTSTP can be resumed with the fg command or SIGCONT.

SIGCONT

{{Info|Signal in a nutshell: Signal number: 18 Purpose: Resume a process paused by SIGSTOP or SIGTSTP. Notes: Using the command "fg" achieves the same result as this signal.} SIGCONT resumes a process which was paused by SIGSTOP or SIGTSTP.

SIGHUP

Signal in a nutshell:

Signal number: 1 Purpose: Notify a process of the termination of its controlling terminal/notify the signaled process that a modem hangup is in progress.

Notes: Most servers/background processes set a trap to this signal and reread their configuration files on SIGHUP reception.

While SIGHUP was initially designed to notify the process that a modem hangup was in progress, it is now used to notify a process that the controlling terminal was closed. Most servers set a trap for this signal and reread their config file on SIGHUP reception.


Further reading