Tagging 2.4RC1 release.
[shibboleth/sp.git] / configs / shibd-suse.in
1 #! /bin/sh
2 # Author: Peter Schober <peter.schober@univie.ac.at> and many others
3 # based on shibd-debian (from Shibboleth's 1.3.1 SP source distribution)
4 # and SUSE's /etc/init.d/cyrus
5 #
6 # /etc/init.d/shibd
7 #
8 ### BEGIN INIT INFO
9 # Provides: shibd
10 # Required-Start: $local_fs $remote_fs $network
11 # Should-Start: $time
12 # Should-Stop: $time
13 # Required-Stop: $local_fs $remote_fs $network
14 # Default-Start: 3 5
15 # Default-Stop: 0 1 2 6 
16 # Short-Description: Shibboleth 2.x Service Provider Daemon
17 # Description: Starts the separate daemon used by the Shibboleth Apache module to manage state and SAML interactions.
18 ### END INIT INFO
19 #
20  
21 DESC="Shibboleth 2 daemon"
22 NAME=shibd
23 SHIB_CONFIG=@-PKGSYSCONFDIR-@/shibboleth2.xml
24 DAEMON=@-PREFIX-@/sbin/$NAME
25 SCRIPTNAME=/etc/init.d/$NAME
26 PID_FILE=@-PKGRUNDIR-@/shibd.pid
27 DAEMON_OPTS=""
28  
29 # Force removal of socket
30 DAEMON_OPTS="$DAEMON_OPTS -f"
31  
32 # Use defined configuration file
33 DAEMON_OPTS="$DAEMON_OPTS -c $SHIB_CONFIG"
34  
35 # Specify pid file to use
36 DAEMON_OPTS="$DAEMON_OPTS -p $PID_FILE"
37
38 # Specify wait time to use
39 DAEMON_OPTS="$DAEMON_OPTS -w 30"
40  
41 # Exit if the package is not installed.
42 test -x "$DAEMON" || exit 5
43  
44 . /etc/rc.status
45  
46 # First reset status of this service
47 rc_reset
48  
49 case "$1" in
50     start)
51         echo -n "Starting $DESC ($NAME)"
52         ## Start daemon with startproc(8). If this fails
53         ## the echo return value is set appropriate.
54  
55         # NOTE: startproc return 0, even if service is
56         # already running to match LSB spec.
57         /sbin/startproc -p $PID_FILE $DAEMON $DAEMON_OPTS > /dev/null 2>&1
58  
59         # Remember status and be verbose
60         rc_status -v
61         ;;
62     stop)
63         echo -n "Shutting down $DESC ($NAME)"
64         ## Stop daemon with killproc(8) and if this fails
65         ## set echo the echo return value.
66  
67         /sbin/killproc -p $PID_FILE -TERM $DAEMON > /dev/null 2>&1
68  
69         # Remember status and be verbose
70         rc_status -v
71         ;;
72     try-restart)
73         ## Stop the service and if this succeeds (i.e. the
74         ## service was running before), start it again.
75         ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
76         $0 status >/dev/null &&  $0 restart
77  
78         # Remember status and be quiet
79         rc_status
80         ;;
81     restart)
82         ## Stop the service and regardless of whether it was
83         ## running or not, start it again.
84         $0 stop
85         $0 start
86  
87         # Remember status and be quiet
88         rc_status
89         ;;
90     configtest)
91         ## Check config files
92  
93         echo -n "Checking config for $DESC ($NAME): "
94         $DAEMON $DAEMON_OPTS -t
95         rc_status -v
96         ;;
97     status)
98         echo -n "Checking for service $DESC ($NAME)"
99         ## Check status with checkproc(8), if process is running
100         ## checkproc will return with exit status 0.
101  
102         # Status has a slightly different for the status command:
103         # 0 - service running
104         # 1 - service dead, but /var/run/  pid  file exists
105         # 2 - service dead, but /var/lock/ lock file exists
106         # 3 - service not running
107  
108         # NOTE: checkproc returns LSB compliant status values.
109         /sbin/checkproc -p $PID_FILE $DAEMON
110         rc_status -v
111         ;;
112     *)
113         echo "Usage: $0 {start|stop|status|configtest|try-restart|restart}"
114         exit 1
115         ;;
116 esac
117 rc_exit