[Opendnssec-user] Deprecating pid-files?

Ondřej Surý ondrej at sury.org
Wed Aug 25 12:22:02 UTC 2010


On Wed, Aug 25, 2010 at 14:15, Jakob Schlyter <jakob at kirei.se> wrote:
> On 25 aug 2010, at 14.06, Ondřej Surý wrote:
>
>> Debian uses following snippet to stop the daemons:
>>
>> do_stop()
>> {
>>        # Return
>>        #   0 if daemon has been stopped
>>        #   1 if daemon was already stopped
>>        #   2 if daemon could not be stopped
>>        #   other if a failure occurred
>>        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5
>> --pidfile $PIDFILE
>>        RETVAL="$?"
>>        [ "$RETVAL" = 2 ] && return 2
>>
>>        # Many daemons don't delete their pidfiles when they exit.
>>        rm -f $PIDFILE
>>        return "$RETVAL"
>> }
>
> This illustrates my problem quite well. In the OpenDNSSEC case you really want to ask the signer engine to exit nicely by running 'ods-signer stop'. You don't know if the signer engine has crash, left the PID-file and some other daemon taken its place.

Well, the TERM signal is a _nice_ way how to ask a daemon to stop (at
least in my System V world :)), the KILL signal is not a nice way. But
yes, the script could be improved and will be improved after it's not
a python and start-stop-daemon is able to check if it is killing the
right binary. Something like:

        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5
--pidfile $PIDFILE --name $NAME

This will get redone once debian adopts a new sysvinit scripts. For
Ubuntu there is upstart already which uses signal as well.

Ondrej
-- 
Ondřej Surý <ondrej at sury.org>



More information about the Opendnssec-user mailing list