Written by J. Moellenkamp
Reading time: 1 minute
pstop and prun
Many people know how to kill a process, but less people know that you can suspend a running process in to resume the execution later.
The test case
I wrote a small script to demonstrate both commands.
It just prints the current time every 2 seconds.
You may have recognized that there is a 31 second gap between
1297973858 for script that should print out the timestamps continiously every two seconds.
What i did in a second shell?
What happened here? At
1297973827</a> i ran the following command:
When you look at the process flags, you will see that the process has been stopped:
A moment before that i found out the process id via
Then i just waited for half a minute and resumed execution with
So the perl scripted resumed to print the timestamps at
1297973858. When you check the pflags again you will see, that the the STOPPED and ISTOP flags went away: