views:

77

answers:

1
+3  Q: 

Pausing a process?

Is there a way to pause a process (running from an executable) so that it stops the cpu load while it's paused, and waits till it's unpaused to go on with its work? Possibly in python, or in some way accessible by python.

+1  A: 

you are thinking of SIGTSTP -- the same signal that happens when you push CTRL-Z. This suspends the process until it gets SIGCONT.

of course, some programs can just catch and ignore this signal, so it depends on the executable. however, if you can suspend and resume it manually, you can do it from a python program, too. use os.kill()

Igor
and how do I unsuspend it so that it continues work from where it was before?
Gabriele Cirulli
Send it a SIGCONT
Florian Diesch
SIGSTOP can't be blocked and would be slightly more accurate in this context, not coming from a tty. http://en.wikipedia.org/wiki/SIGSTOP
msw