Re: suspending a pid
Lo, on , November 24, Michael Heldebrant did write:
> On Sat, 2001-11-24 at 08:31, martin f krafft wrote:
> > hi all,
> > given a PID of a process that hasn't been started from a terminal, is
> > there anyway i can suspend it? i am root, and init started process x,
> > is there a way that i can suspend x at any point during normal
> > operation, and also to unfreeze it again?
> I think a kill -STOP PID and a kill -CONT PID will allow you to do
> what you want. STOP is a nonblockable signal according to the kill
> man page so this should work regardless of the antisuspend
> intelligence of a process.
According to _Linux Application Development_ by Johnson & Troan, secton
14.1.3, you'll probably have better results in general doing a
kill -TSTP <pid>
instead of kill -STOP <pid>. This has the advantage of letting the
program take any necessary action before suspending itself; console-mode
instances of vi and emacs, for instance, will need to reset the terminal
and redraw the screen. After cleaning up like this, the program's
signal handler for SIGTSTP should suspend the process.
If this doesn't work, it's because the program in question isn't playing
by Unix rules. kill -STOP it and complain to the maintainer or vendor.
However you stop it, kill -CONT will resume the stopped process.