# Startup script for the Shibboleth Service Provider Daemon
#
# chkconfig: - 98 02
-# description: Shibboleth Service Provider Daemon
+# description: Shibboleth 2 Service Provider Daemon
# processname: shibd
-# pidfile: @-VARRUNDIR-@/shibd.pid
-# config: @-PKGSYSCONFDIR-@/shibboleth.xml
+# pidfile: @-PKGRUNDIR-@/shibd.pid
+# config: @-PKGSYSCONFDIR-@/shibboleth2.xml
# Source function library.
. /etc/rc.d/init.d/functions
shibd="@-PREFIX-@/sbin/shibd"
SHIBD_USER=root
-pidfile=@-VARRUNDIR-@/shibd.pid
+pidfile=@-PKGRUNDIR-@/shibd.pid
prog=shibd
+VER=`cat /etc/redhat-release | awk '{print $3}' | awk -F . '{print $1}'`
RETVAL=0
start() {
if checkpid $kpid 2>&1; then
echo "process already running"
return -1
- else
+ else
echo "lock file found but no process running for pid $kpid, continuing"
fi
fi
export SHIBD_PID=$pidfile
touch $pidfile
chown $SHIBD_USER:$SHIBD_USER $pidfile
- # daemon function just hangs, so I'm using su directly
- su - $SHIBD_USER -c "$shibd -p $pidfile -f &"
+ if [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+ /sbin/restorecon $pidfile
+ fi
+ if [ 5 -le $VER ] ; then
+ daemon --user $SHIBD_USER --pidfile $pidfile $shibd -p $pidfile -f -w 30
+ else
+ daemon --user $SHIBD_USER $shibd -p $pidfile -f -w 30
+ fi
RETVAL=$?
echo
stop() {
echo -n $"Stopping $prog: "
- if [ -f $pidfile ]; then
- read kpid < $pidfile
- kill $kpid
+ if [ -f $pidfile -a 5 -le $VER] ; then
+ killproc -p $pidfile shibd
else
- killproc shibd
+ killproc shibd
fi
RETVAL=$?
stop
;;
status)
- status $shibd
+ status $shibd
RETVAL=$?
;;
restart)
start
;;
*)
- echo $"Usage: $prog {start|stop|restart}"
+ echo $"Usage: $prog {start|stop|status|restart}"
exit 1
esac