Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 623
Gabriele Cirulli Avatar asked May 10 '10 16:05

Gabriele Cirulli


1 Answers

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()

like image 128
Igor Serebryany Avatar answered Sep 18 '22 13:09

Igor Serebryany