SSPCPP-654 - Move fork wait timeout from init script to sysconfig
[shibboleth/cpp-sp.git] / configs / shibd-debian.in
1 #! /bin/sh
2 ### BEGIN INIT INFO
3 # Provides: shibd
4 # Required-Start: $local_fs $remote_fs $network
5 # Required-Stop: $local_fs $remote_fs $network
6 # Default-Start: 2 3 4 5
7 # Default-Stop: 0 1 6
8 # Short-Description: Shibboleth 2 Service Provider Daemon
9 # Description: Starts the separate daemon used by the Shibboleth
10 # Apache module to manage sessions and to retrieve
11 # attributes from Shibboleth Identity Providers.
12 ### END INIT INFO
13 #
14 # Written by Quanah Gibson-Mount <quanah@stanford.edu>
15 # Modified by Lukas Haemmerle <lukas.haemmerle@switch.ch> for Shibboleth 2
16 # Based on the dh-make template written by:
17 #
18 # Written by Miquel van Smoorenburg <miquels@cistron.nl>.
19 # Modified for Debian
20 # by Ian Murdock <imurdock@gnu.ai.mit.edu>.
21
22 PATH=/sbin:/bin:/usr/sbin:/usr/bin
23 DESC="Shibboleth 2 daemon"
24 NAME=shibd
25 SHIB_HOME=@-PREFIX-@
26 SHIBSP_CONFIG=@-PKGSYSCONFDIR-@/shibboleth2.xml
27 SHIBD_WAIT=30
28 LD_LIBRARY_PATH=@-PREFIX-@/lib
29 DAEMON=@-PREFIX-@/sbin/$NAME
30 SCRIPTNAME=/etc/init.d/$NAME
31 PIDFILE=@-PKGRUNDIR-@/$NAME.pid
32 DAEMON_OPTS=""
33
34 # Read configuration if it is present.
35 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
36
37 # Force removal of socket
38 DAEMON_OPTS="$DAEMON_OPTS -f"
39
40 # Use defined configuration file
41 DAEMON_OPTS="$DAEMON_OPTS -c $SHIBSP_CONFIG"
42
43 # Specify pid file to use
44 DAEMON_OPTS="$DAEMON_OPTS -p $PIDFILE"
45
46 # Specify wait time to use
47 DAEMON_OPTS="$DAEMON_OPTS -w $SHIBD_WAIT"
48
49 # Exit if the package is not installed.
50 [ -x "$DAEMON" ] || exit 0
51
52 # Get the setting of VERBOSE and other rcS variables.
53 [ -f /etc/default/rcS ] && . /etc/default/rcS
54
55 case "$1" in
56 start)
57     # Don't start shibd if NO_START is set.
58     if [ "$NO_START" = 1 ] ; then
59         echo "Not starting $DESC (see /etc/default/$NAME)"
60         exit 0
61     fi
62     echo -n "Starting $DESC: "
63     start-stop-daemon --start --quiet \
64         --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
65     echo "$NAME."
66     ;;
67 stop)
68     echo -n "Stopping $DESC: "
69     start-stop-daemon --stop --quiet --pidfile $PIDFILE \
70         --exec $DAEMON
71     echo "$NAME."
72     ;;
73 restart|force-reload)
74     echo -n "Restarting $DESC: "
75     start-stop-daemon --stop --quiet --pidfile $PIDFILE \
76         --exec $DAEMON
77     sleep 1
78     start-stop-daemon --start --quiet \
79         --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
80     echo "$NAME."
81     ;;
82 *)
83     echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
84     exit 1
85     ;;
86 esac
87
88 exit 0