Re: Signal Handlers for a Daemon?

From: Glen (glensantacruz_at_yahoo.com)
Date: 05/05/04


Date: 5 May 2004 05:31:53 -0700


> SIGHUP is normally used to tell a deamon to:
>
> -- close and re-open its log files (so that log files can be
> rotated), and
>
> -- re-read its initialisation file, so that daemon parameters
> can be changed on the fly.

Notable programs that use SIGHUP in this way on linux: bootpd(8),
gated(8), inted(8), mountd(8), named(8), nfsd(8), ypbind(8).

Note that SIGHUP was originally used to shutdown a daemon when a modem
connection terminated. Linux pppd(8) still uses SIGHUP as a shutdown
signal although nowdays SIGTERM is used for that purpose.

SIGUSR1, SIGUSR2 can be used as general purpose signals for
communication with your daemon: telling it to wake up and do work,
writing debugging info to a file, etc.

If you're looking for a resource, try 'Unix Network Programming' vol
1, 3rd edition by Stevens, Fenner & Rudoff.

Cheers,
Glen.