previous contents up next

Unix for Advanced Users

10. Process Management under Unix

10.5. Talking to Running Processes

Unix provides a way for a user to communicate with a running process. This is accomplished via signals, a facility which enables a running process to be notified about the occurrence of a) an error event generated by the executing process, or b) an asynchronous event generated by a process outside the executing process.

Signals are sent to the process ultimately by the kernel. The receiving process has to be programmed such that it can catch a signal and take a certain action depending on which signal was sent.

Here is a list of common signals and their numerical values:

(Many more signals exist; these are the most commonly used ones.)

You send a running process a signal using the Unix kill command. The basic usage is

Example - The most common use of signals is to send the HUP signal (1) to a long running daemon to make it reread its configuration file. We'll do this exercise in light sysadmin tasks.

Run the script uau_signal from /usr/local/bin. This is a shell script which uses the Bourne shell trap command to catch signals. Run the script and send it various signals to see what it does.

previous contents up next