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