help-shishi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debian shishi package bug


From: Simon Josefsson
Subject: Re: Debian shishi package bug
Date: Tue, 02 May 2006 10:36:25 +0200
User-agent: Gnus/5.110005 (No Gnus v0.5) Emacs/22.0.50 (gnu/linux)

Elrond <address@hidden> writes:

> On Mon, May 01, 2006 at 09:47:28AM -0700, Russ Allbery wrote:
> [...]
>> > ### BEGIN INIT INFO
>> > # Provides:          skeleton
>> > # Required-Start:    $local_fs $remote_fs
>> > # Required-Stop:     $local_fs $remote_fs
>> > # Default-Start:     2 3 4 5
>> > # Default-Stop:      S 0 1 6
>> > # Short-Description: Example initscript
>> > # Description:       This file should be used to construct scripts to be
>> > #                    placed in /etc/init.d.
>> > ### END INIT INFO
>> 
>> > Perhaps we should update the init script...
>> 
>> Huh, I've not seen that before.  I wonder if that's part of LSB, since it
>> looks a little like the init script headers used in SuSE and Red Hat.
>
> It's lsb.
>
> Let me make up one for shishi-kdc (appended below).
>
> I'd suggest keeping all the comments below the main block
> to have the reasons somewhere.

Thanks!  Here is a complete file.  I changed 'shishi-kdc' to 'shishid'
because that's the current name, and also dropped $named because a KDC
should never rely on DNS (and for that matter, nor should Kerberos
clients -- until DNSSEC is supported).

I made some other changes to the file too, but I was careful to not
modify the stop/start commands too much.  I added the --retry
parameter for --stop (from the skeleton), which looked useful.

shishid also depend on lsb-base now:

Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.0-6)

This will require more testing, but I've installed this for now.  We
can always revert it if it doesn't turn out well.

/Simon

#! /bin/sh
### BEGIN INIT INFO
# Provides: shishid
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Default-Start: 3 4 5
# Default-Stop: S 0 1 2 6
# Short-Description: shishid - Kerberos Key Distribution Center (KDC)
# Description: 
#       Start/stop the kerberos authentication service
#       main server, the Key Distribution Center (KDC)
### END INIT INFO

# Author: Simon Josefsson <address@hidden>

# Some comments about above choosing:
# At start:
#    $remote_fs: So /usr and all other filesystems are there.
#    $network: Probably better, when the interfaces are up.
#    $syslog: So we can feed our important logs somewhere at startup.
#             You want to know, why it's not starting, right?
# The above reasons mainly count for stop as well, so here some
# extra notes:
#    $remote_fs: So we can close files cleanly.

# Do NOT "set -e"

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="Shishi Kerberos v5 KDC daemon"
NAME=shishid
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS=""
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# Define LSB log_* functions.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
        start-stop-daemon --start --oknodo --background --quiet \
            --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS $DAEMON_OPTS
}

#
# Function that stops the daemon/service
#
do_stop()
{
        start-stop-daemon --stop --oknodo --quiet \
            --pidfile $PIDFILE --retry=TERM/30/KILL/5 --exec $DAEMON
        RETVAL="$?"
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
        return "$RETVAL"
}

case "$1" in
  start)
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  stop)
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
        esac
        ;;
  restart|force-reload)
        log_daemon_msg "Restarting $DESC" "$NAME"
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                        0) log_end_msg 0 ;;
                        1) log_end_msg 1 ;; # Old process is still running
                        *) log_end_msg 1 ;; # Failed to start
                esac
                ;;
          *)
                # Failed to stop
                log_end_msg 1
                ;;
        esac
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac

:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]