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
10 # Required-Start: $local_fs $remote_fs $network
13 # Required-Stop: $local_fs $remote_fs $network
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.
21 DESC="Shibboleth 2 daemon"
23 SHIB_CONFIG=@-PKGSYSCONFDIR-@/shibboleth2.xml
24 DAEMON=@-PREFIX-@/sbin/$NAME
25 SCRIPTNAME=/etc/init.d/$NAME
26 PID_FILE=@-PKGRUNDIR-@/shibd.pid
30 # Force removal of socket
31 DAEMON_OPTS="$DAEMON_OPTS -f"
33 # Use defined configuration file
34 DAEMON_OPTS="$DAEMON_OPTS -c $SHIB_CONFIG"
36 # Specify pid file to use
37 DAEMON_OPTS="$DAEMON_OPTS -p $PID_FILE"
39 # Specify wait time to use
40 DAEMON_OPTS="$DAEMON_OPTS -w 30"
42 [ -e /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
44 # Exit if the package is not installed.
45 test -x "$DAEMON" || exit 5
49 # First reset status of this service
54 # Make sure package run directory exists.
55 [ -d @-PKGRUNDIR-@ ] || mkdir @-PKGRUNDIR-@
57 # Handle transition from root to non-root packages.
58 chown -R $SHIBD_USER:$SHIBD_USER @-PKGRUNDIR-@ @-PKGCACHEDIR-@ 2>/dev/null || :
60 # Adjust native logging directory permission so log roll-over works
61 chown wwwrun:www @-SHIRELOGDIR-@
63 echo -n "Starting $DESC ($NAME)"
64 ## Start daemon with startproc(8). If this fails
65 ## the echo return value is set appropriate.
67 # NOTE: startproc return 0, even if service is
68 # already running to match LSB spec.
69 /sbin/startproc -u $SHIBD_USER -p $PID_FILE $DAEMON $DAEMON_OPTS > /dev/null 2>&1
71 # Remember status and be verbose
75 echo -n "Shutting down $DESC ($NAME)"
76 ## Stop daemon with killproc(8) and if this fails
77 ## set echo the echo return value.
79 /sbin/killproc -p $PID_FILE -TERM $DAEMON > /dev/null 2>&1
81 # Remember status and be verbose
85 ## Stop the service and if this succeeds (i.e. the
86 ## service was running before), start it again.
87 ## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
88 $0 status >/dev/null && $0 restart
90 # Remember status and be quiet
94 ## Stop the service and regardless of whether it was
95 ## running or not, start it again.
99 # Remember status and be quiet
103 ## Check config files
105 echo -n "Checking config for $DESC ($NAME): "
106 $DAEMON $DAEMON_OPTS -t
110 echo -n "Checking for service $DESC ($NAME)"
111 ## Check status with checkproc(8), if process is running
112 ## checkproc will return with exit status 0.
114 # Status has a slightly different for the status command:
115 # 0 - service running
116 # 1 - service dead, but /var/run/ pid file exists
117 # 2 - service dead, but /var/lock/ lock file exists
118 # 3 - service not running
120 # NOTE: checkproc returns LSB compliant status values.
121 /sbin/checkproc -p $PID_FILE $DAEMON
125 echo "Usage: $0 {start|stop|status|configtest|try-restart|restart}"