Re: how to send control-break or ctrl-c signal to a background process?
From: Bryan Dongray (btd_at_dongrays.com)
Date: 09/28/03
- Next message: Stephen Copp: "Re: how to logon to 30+ machines and put a job run in background and then logout automatically in a script file?"
- Previous message: Kamal R. Prasad: "Re: cpp - C language preprocessor"
- In reply to: walala: "how to send control-break or ctrl-c signal to a background process?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 28 Sep 2003 14:10:05 -0500
walala wrote:
> Dear all,
>
> I have sent a job to run in background... However I now want to gracefully
> terminate it. This software has a good property that if I press
> control-break, or ctrl-c, it will enter into a graceful termination mode
> that it can still give me some partial useful information... so I don't want
> to use "kill -9" to kill it...
>
> instead, since it is run in background, I hope I can sent it a control-break
> or ctrl-c signal then it can output some partial useful information to the
> log file and then gracefully shutdown...
>
> Can anybody help me on how to do that?
Control-C is normally associated with SIGINT, which is most
likely be able to be sent using either:
kill -2 $PID
kill -INT $PID
but check your systems options for kill in the manual pages.
It is often likely that code traps the terminate signal (SIGTERM)
which is normally signal number 15, which is the default sent
by kill anyway, so if the code is usual, then:
kill $PID
will send a TERM signal, and everything should be good.
You should only use "kill -9" in desperate situations, as
it gives the process no option but to stop immediately,
no tidying up of temp files, nor logging of anything.
- Next message: Stephen Copp: "Re: how to logon to 30+ machines and put a job run in background and then logout automatically in a script file?"
- Previous message: Kamal R. Prasad: "Re: cpp - C language preprocessor"
- In reply to: walala: "how to send control-break or ctrl-c signal to a background process?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|