Re: how to send control-break or ctrl-c signal to background process?

From: Logan Shaw (lshaw-usenet_at_austin.rr.com)
Date: 09/28/03


Date: Sun, 28 Sep 2003 03:05:13 GMT

walala wrote:
> 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...

It is possible to use "kill" without typing "-9", you know...

> 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...

Just type "kill 1234", where "1234" is the process number.
This is short for "kill -INT 1234", which sends a SIGINT
signal to the process.

As it turns out, this just what happens to the process if you
hit Control-C. The terminal driver intercepts the Control-C
character and sends a SIGINT to "all foreground processes".
(You might also be interested to know that Control-Z sends a
SIGTSTP signal to a process.) If you want, you can change
which characters do this by using "stty". "man termio" will
give you more information about the settings.

   - Logan



Relevant Pages

  • Re: Arrow keys dont work in "read" command of bash
    ... readline is used ... used to remove any special meaning for the next character read ... The first character of delim is used to terminate the ... Display prompt on standard error, ...
    (comp.os.linux.misc)
  • Re: How to terminate a text file line in Unicode (in Java)
    ... stream encoding was set to »UTF-8«, what is the proper, best ... The primary question is how to terminate a line in Unicode. ... It does not define "the" line breaking character. ...
    (comp.std.internat)
  • Re: opening and reading a character from a file with emu8086 assembler
    ... reads on character at a time and print each character on the ... >> jc terminate;if error occurs, ... >> int 21h ... > As for the infinite loop, the carry is not set at EOF. ...
    (comp.lang.asm.x86)
  • Re: Field Independence in Normalised Tables
    ... only letters, numbers, and the underscore character. ... I have been reading about normalization. ... Employees hire and fire dates are a separate subset of data. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: macro-reader
    ... identifier, it won't terminate that token, but will be incorporated ... into it as a constituent. ... Why \] is a terminating macro character and \} not. ... They can be in different readtables. ...
    (comp.lang.lisp)