The
interprocess communication of job control is implemented via
signals. Typically, a shell maintains information about background jobs in a job table. When an
interactive session ends (i.e. user
logs out), the shell sends signal
SIGHUP to all jobs, and waits for the process groups to exit before terminating itself. Some shells provide a non-POSIX command
disown that removes a job from the job table. The process group becomes an
orphan. The shell will not send it SIGHUP, nor wait for it to terminate. This is one technique for enabling a process as a
daemon owned directly by the root process
init. The POSIX command nohup| provides an alternate way to prevent a job from being terminated by the shell. Suspending the foreground job (via ) sends signal SIGTSTP (terminal stop) to the processes of the group. By default, this signal causes a process to pause so that the shell can resume. However, a process can ignore the signal. A process can also be paused via signal SIGSTOP (stop), which cannot be ignored. When the user presses , the shell sends signal
SIGINT (interrupt) to each foreground job process, which defaults to terminating it, though a process can ignore the signal. When a stopped job is resumed (via or ), the shell redirects
Input/output and resumes it by sending signal SIGCONT to it. A background process that attempts to read from or write to its
controlling terminal is sent signal SIGTTIN (for input) or SIGTTOU (for output). These signals stop the process by default, but they may also be handled in other ways. Shells often override the default stop action of SIGTTOU so that background processes deliver their output to the controlling terminal by default. In bash, the
kill builtin (not /bin/kill) can signal jobs by ID as well as by process group ID. Sending a signal to a job sends it to each process of the group. kill can send any signal to a job; however, if the intent is to rid the system of the processes, the signals
SIGKILL and
SIGTERM (the default) are probably the most applicable.