daemon monitoring

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Nov 24 02:51:32 PST 2003

On Mon, Nov 24, 2003 at 01:19:21AM +0000, Jez Hancock wrote:

> - for each pid, send a CHLD signal to the pid

Careful -- not all processes will be set up to deal with SIGCHLD, and
some of them will be set up to deal with it in ways that don't meet
your expectations.

You can use signal '0' to test if a process of a given PID exists,
without obnoxious side effects:

    % kill -0 $$
    % echo $?
    % kill -0 999
    999: No such process
    % echo $?

However you need to be careful as kill is a shell built-in in many
shells -- tcsh(1) has a built-in but it behaves just like /bin/kill in
this case.  sh(1) and bash(1) seem not to use a built-in.



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20031124/01a00887/attachment.bin

More information about the freebsd-questions mailing list