Use sh instead of pagsh for init scripts
[hcoop/domtool2.git] / scripts / domtool-server
index 6d45215..94ffda3 100755 (executable)
@@ -1,25 +1,44 @@
-#!/usr/bin/pagsh.openafs
+#!/bin/sh
+# -*- sh -*-
 
-# This script should go in /etc/init.d/ on Debian Linux systems running Domtool dispatchers.
+# This script should go in /etc/init.d/ on Debian Linux systems
+# running Domtool dispatchers.
+
+# This script is NOT lsb compliant by a long shot... need to fix that
+
+### BEGIN INIT INFO
+# Provides:             domtool-server
+# Required-Start:       $remote_fs $network $time openafs-client nscd
+# Required-Stop:        $remote_fs $network openafs-client nscd
+# Default-Start:        2 3 4 5
+# Default-Stop:         0 1 6
+# Short-Description:    Domtool Dispatcher
+# Description:          Launches the domtool server
+### END INIT INFO
 
 SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
-PIDFILE="/var/run/k5start-domtool-server.pid"
+PIDFILE="/var/run/domtool/k5start-server.pid"
 
-set -e
+. /lib/lsb/init-functions
 
 case $1 in
   start)
-       # Start daemon
-       echo -n "Starting Domtool dispatcher: domtool-server"
+       log_daemon_msg "Starting Domtool dispatcher" "domtool-server"
        if sudo -u domtool domtool-admin-sudo ping; then
                echo "...already running."
        else
+               PIDDIR=$(dirname "$PIDFILE")
+               if test ! -d "$PIDDIR"; then
+                       mkdir -m 0750 $PIDDIR
+                       chown domtool:nogroup $PIDDIR
+               fi
+
                start-stop-daemon --start --pidfile $PIDFILE \
-                       -c domtool:domtool \
-                       --exec /usr/bin/k5start -- -b -f /etc/keytabs/domtool.keytab \
+                       -c domtool:nogroup \
+                       --exec /usr/bin/k5start -- -U -b \
+                       -f /etc/keytabs/domtool \
                        -K 300 -t -p $PIDFILE \
-                       domtool/deleuze.hcoop.net \
-                       domtool-server-logged
+                       /usr/local/bin/domtool-server-logged
                echo "."
        fi
        ;;
@@ -36,7 +55,7 @@ case $1 in
        ;;
 
   restart|reload|force-reload)
-       $SELF stop
+       set +e; $SELF stop; set -e
        $SELF start
        ;;