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