fwtool: allow udp/tcp for all user rules
[hcoop/domtool2.git] / scripts / domtool-slave
CommitLineData
83801e65 1#!/bin/sh
ea459e3e 2# -*- sh -*-
c9731b9b 3
a78867dd
MO
4# This script should go in /etc/init.d/ on Debian Linux systems
5# running Domtool slaves.
c9731b9b 6
ea459e3e
CE
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
c9731b9b 20SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
a78867dd 21PIDFILE="/var/run/domtool/k5start-slave.pid"
c9731b9b 22
ea459e3e 23. /lib/lsb/init-functions
c9731b9b
AC
24
25case $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
a78867dd
MO
31 PIDDIR=$(dirname "$PIDFILE")
32 if test ! -d "$PIDDIR"; then
ea459e3e
CE
33 mkdir -m 0750 $PIDDIR
34 chown domtool:nogroup $PIDDIR
a78867dd
MO
35 fi
36
c9731b9b 37 start-stop-daemon --start --pidfile $PIDFILE \
ea459e3e 38 -c domtool:nogroup \
e8872a45 39 --exec /usr/bin/k5start -- -U -b \
721ff8cc 40 -f /etc/keytabs/domtool \
c9731b9b 41 -K 300 -t -p $PIDFILE \
ea459e3e 42 /usr/local/bin/domtool-slave-logged
c9731b9b
AC
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)
cf1be826 59 set +e; $SELF stop; set -e
c9731b9b
AC
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 ;;
76esac