config: warn that changing localRoot will not work currently
[hcoop/domtool2.git] / scripts / domtool-server
CommitLineData
83801e65
CE
1#!/bin/sh
2# -*- sh -*-
62260c5f 3
a78867dd
MO
4# This script should go in /etc/init.d/ on Debian Linux systems
5# running Domtool dispatchers.
62260c5f 6
ea459e3e
CE
7# This script is NOT lsb compliant by a long shot... need to fix that
8
9### BEGIN INIT INFO
10# Provides: domtool-server
11# Required-Start: $remote_fs $network $time openafs-client nscd
12# Required-Stop: $remote_fs $network openafs-client nscd
13# Default-Start: 2 3 4 5
14# Default-Stop: 0 1 6
15# Short-Description: Domtool Dispatcher
16# Description: Launches the domtool server
17### END INIT INFO
18
62260c5f 19SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
a78867dd 20PIDFILE="/var/run/domtool/k5start-server.pid"
62260c5f 21
ea459e3e 22. /lib/lsb/init-functions
62260c5f
AC
23
24case $1 in
25 start)
ea459e3e 26 log_daemon_msg "Starting Domtool dispatcher" "domtool-server"
62260c5f
AC
27 if sudo -u domtool domtool-admin-sudo ping; then
28 echo "...already running."
29 else
a78867dd
MO
30 PIDDIR=$(dirname "$PIDFILE")
31 if test ! -d "$PIDDIR"; then
ea459e3e
CE
32 mkdir -m 0750 $PIDDIR
33 chown domtool:nogroup $PIDDIR
a78867dd
MO
34 fi
35
62260c5f 36 start-stop-daemon --start --pidfile $PIDFILE \
ea459e3e 37 -c domtool:nogroup \
e8872a45 38 --exec /usr/bin/k5start -- -U -b \
721ff8cc 39 -f /etc/keytabs/domtool \
62260c5f 40 -K 300 -t -p $PIDFILE \
ea459e3e 41 /usr/local/bin/domtool-server-logged
62260c5f
AC
42 echo "."
43 fi
44 ;;
45
46 stop)
47 echo -n "Stopping Domtool dispatcher: domtool-server"
48 if sudo -u domtool domtool-admin-sudo shutdown; then
49 echo "."
50 else
51 start-stop-daemon --stop --pidfile $PIDFILE
52 echo "."
53 fi
54 rm -f $PIDFILE
55 ;;
56
57 restart|reload|force-reload)
cf1be826 58 set +e; $SELF stop; set -e
62260c5f
AC
59 $SELF start
60 ;;
61
62 status)
63 if sudo -u domtool domtool-admin-sudo ping; then
64 echo "Domtool dispatcher is running."
65 else
66 echo "Domtool dispatcher is stopped."
67 exit 3
68 fi
69 ;;
70
71 *)
72 echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
73 exit 1
74 ;;
75esac