While performing regular administrative duties on any server, you will often find yourself in the position to need to suspend and resume processes. Luckily, nearly all shells on modern systems will have some sort of job control built in to address these needs.
A job is really just another term for a process group. This will commonly be just a single application, but is not exclusive to that idea. Any process group which is not receiving terminal input is considered a background job, while a process group that does receive terminal input is a foreground job. In order for a shell to control these jobs, various IPC calls (termed signals) can be sent to the job which can be interpreted by various signal handlers inside the program.
Conveniently, most programs don't need to define any signal handlers. There is a default set that gets included into each program, and can be generically used.
The most common signals for job control are often as follows: SIGTSTOP SIGCONT SIGINT
There are two main ways we can send these signals. * We can use keyboard shortcuts to instruct the shell to send a particular signal * We can use the kill command to send a signal to a particular process ID
Traditionally, the suspend character has been mapped to Ctrl+Z (SIGSTOP), which will temporarily suspend your process. Similarly, the interrupt character can be signaled by pressing Ctrl+C (SIGINT) on your keyboard.
A lesser known secret is we can send any signal we want to an application using the kill command. It doesn't have to simply interrupt a program. Let's say we have a process with the ID of 1337, and we want to suspend it. We can easily do the following:
$ kill -SIGSTOP 1337
Likewise, once we are ready to resume the process, we can use kill to send it the SIGCONT signal:
$ kill -SIGCONT 1337
And there you have it! The man pages cover a wide range of additional signals that can be used for various purposes, but mastering even just these simple signal techniques will make a significant difference to your administrative abilities.