* Safer handling of $1 in all scripts
[hcoop/domtool2.git] / scripts / domtool-server
CommitLineData
62260c5f
AC
1#!/usr/bin/pagsh.openafs
2
3# This script should go in /etc/init.d/ on Debian Linux systems running Domtool dispatchers.
4
5SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
6PIDFILE="/var/run/k5start-domtool-server.pid"
7
8set -e
9
10case $1 in
11 start)
62260c5f
AC
12 echo -n "Starting Domtool dispatcher: domtool-server"
13 if sudo -u domtool domtool-admin-sudo ping; then
14 echo "...already running."
15 else
16 start-stop-daemon --start --pidfile $PIDFILE \
17 -c domtool:domtool \
e8872a45 18 --exec /usr/bin/k5start -- -U -b \
721ff8cc 19 -f /etc/keytabs/domtool \
62260c5f 20 -K 300 -t -p $PIDFILE \
62260c5f
AC
21 domtool-server-logged
22 echo "."
23 fi
24 ;;
25
26 stop)
27 echo -n "Stopping Domtool dispatcher: domtool-server"
28 if sudo -u domtool domtool-admin-sudo shutdown; then
29 echo "."
30 else
31 start-stop-daemon --stop --pidfile $PIDFILE
32 echo "."
33 fi
34 rm -f $PIDFILE
35 ;;
36
37 restart|reload|force-reload)
38 $SELF stop
39 $SELF start
40 ;;
41
42 status)
43 if sudo -u domtool domtool-admin-sudo ping; then
44 echo "Domtool dispatcher is running."
45 else
46 echo "Domtool dispatcher is stopped."
47 exit 3
48 fi
49 ;;
50
51 *)
52 echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
53 exit 1
54 ;;
55esac