Stopping a process
Sometimes we want to suspend a process execution. While for those which are running in foreground in terminal, we can use
CTRL + Z shortcut, what about processes that run in the background? For instance, how we can stop a deamon process?
Fortunately, there is a special Unix signal called
SIGSTOP. When this signal is sent to the running process, kernel will suspend the given process, which will stay suspended till the
SIGCONT signal will be sent.
This is how it look like from the command line:
# suspend kill -STOP PID # resume kill -CONT PID
I can imagine one situation when this feature can be useful. Let’s suppose, there is
PHP application which utilises
MySQL database. When we want to test how the application will behave when database will stop responding, we can just send
MySQL process. Despite sending this signal, all of the connections between those two will be preserved. This would be a similar situation of what happens when we experience heavy load on our machines.