| 1 | #!/bin/sh |
| 2 | # -*- sh -*- |
| 3 | |
| 4 | # This script should go in /etc/init.d/ on Debian Linux systems |
| 5 | # running Domtool dispatchers. |
| 6 | |
| 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 | |
| 19 | SELF=$(cd $(dirname $0); pwd -P)/$(basename $0) |
| 20 | PIDFILE="/var/run/domtool/k5start-server.pid" |
| 21 | |
| 22 | . /lib/lsb/init-functions |
| 23 | |
| 24 | case $1 in |
| 25 | start) |
| 26 | log_daemon_msg "Starting Domtool dispatcher" "domtool-server" |
| 27 | if sudo -u domtool domtool-admin-sudo ping; then |
| 28 | echo "...already running." |
| 29 | else |
| 30 | PIDDIR=$(dirname "$PIDFILE") |
| 31 | if test ! -d "$PIDDIR"; then |
| 32 | mkdir -m 0750 $PIDDIR |
| 33 | chown domtool:nogroup $PIDDIR |
| 34 | fi |
| 35 | |
| 36 | start-stop-daemon --start --pidfile $PIDFILE \ |
| 37 | -c domtool:nogroup \ |
| 38 | --exec /usr/bin/k5start -- -U -b \ |
| 39 | -f /etc/keytabs/domtool \ |
| 40 | -K 300 -t -p $PIDFILE \ |
| 41 | /usr/local/bin/domtool-server-logged |
| 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) |
| 58 | set +e; $SELF stop; set -e |
| 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 | ;; |
| 75 | esac |