Fix backslashes in SHIBSP_PREFIX variable by manually creating it during the script...
[shibboleth/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: S 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 LD_LIBRARY_PATH=@-PREFIX-@/lib
28 DAEMON=@-PREFIX-@/sbin/$NAME
29 SCRIPTNAME=/etc/init.d/$NAME
30 PIDFILE=@-PKGRUNDIR-@/$NAME.pid
31 DAEMON_OPTS=""
32
33 # Force removal of socket
34 DAEMON_OPTS="$DAEMON_OPTS -f"
35
36 # Use defined configuration file
37 DAEMON_OPTS="$DAEMON_OPTS -c $SHIBSP_CONFIG"
38
39 # Specify pid file to use
40 DAEMON_OPTS="$DAEMON_OPTS -p $PIDFILE"
41
42 # Exit if the package is not installed.
43 [ -x "$DAEMON" ] || exit 0
44
45 # Read configuration if it is present.
46 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
47
48 # Get the setting of VERBOSE and other rcS variables.
49 [ -f /etc/default/rcS ] && . /etc/default/rcS
50
51 case "$1" in
52 start)
53     # Don't start shibd if NO_START is set.
54     if [ "$NO_START" = 1 ] ; then
55         echo "Not starting $DESC (see /etc/default/$NAME)"
56         exit 0
57     fi
58     echo -n "Starting $DESC: "
59     start-stop-daemon --background --start --quiet \
60         --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
61     echo "$NAME."
62     ;;
63 stop)
64     echo -n "Stopping $DESC: "
65     start-stop-daemon --stop --quiet --pidfile $PIDFILE \
66         --exec $DAEMON
67     echo "$NAME."
68     ;;
69 restart|force-reload)
70     echo -n "Restarting $DESC: "
71     start-stop-daemon --stop --quiet --pidfile $PIDFILE \
72         --exec $DAEMON
73     sleep 1
74     start-stop-daemon --background --start --quiet \
75         --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_OPTS
76     echo "$NAME."
77     ;;
78 *)
79     echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
80     exit 1
81     ;;
82 esac
83
84 exit 0