On Tue, 19 Aug 2003 14:20:49 +0430 (IRST)
Behdad Esfahbod <[EMAIL PROTECTED]> wrote:
> How to stop a process from a shell script (or C code)? I mean
> like pushing Ctrl+Z. When I try kill -STOP pid, the process
> terminates.
There are several signals that may stop the process:
SIGTSTP - May be sent from the keyboard. Normally bound
to Ctrl+Z (may be changed via stty(1)). Application
may ignore/catch this signal.
SIGSTOP - May only be sent explicitly (via kill(1) or kill(2)).
Application cannot ignore/catch this signal (similar
to SIGKILL in this respect)
SIGTTIN - Sent by the tty driver to a process in the background
trying to read from the tty. Application may ignore/catch
this signal (not that it could read the data though...)
SIGTTOU - May be sent by the tty driver to a process in the background
trying to write to the tty (configured via stty
tostop/-tostop). Application may ignore/catch this
signal.
For all these signals. The signal to "wake-up" the application is SIGCONT.
Note that kill -TSTP and kill -STOP should behave equally unless the
process ignote/catch SIGTSTP (which it cannot do with SIGSTOP).
Hope it helps.
--
Oron Peled Voice/Fax: +972-4-8228492
[EMAIL PROTECTED] http://www.actcom.co.il/~oron
Free software: each person contributes a brick, but ultimately each
person receives a house in return.
-- Brendan Scott
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]