File openca-ocspd.init of Package ocspd-3.1.3
#!/bin/sh
### BEGIN INIT INFO
# Provides: ocspd
# Required-Start: $syslog $local_fs $network
# Should-Start: $time
# Required-Stop: $syslog $local_fs $network
# Should-Stop: $time
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: OpenCA ocsp responder
# Description: OpenCA ocsp responder
### END INIT INFO
# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
OPENCA_OCSP_BIN=/usr/sbin/ocspd
test -x $OPENCA_OCSP_BIN || { echo "$OPENCA_OCSP_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
OPENCA_OCSP_OPTIONS=""
OPENCA_OCSP_CONFIG_FILE=/etc/ocspd/ocspd.xml
# Check for existence of needed config file
test -r $OPENCA_OCSP_CONFIG_FILE || { echo "$OPENCA_OCSP_CONFIG_FILE not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
OPENCA_OCSP_PID="/var/run/ocspd/ocspd.pid"
# Source LSB init functions
. /etc/rc.status
# Reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting ocsp "
/sbin/startproc $OPENCA_OCSP_BIN -c $OPENCA_OCSP_CONFIG_FILE $OPENCA_OCSP_OPTIONS
rc_status -v
;;
stop)
echo -n "Shutting down ocsp "
/sbin/killproc $OPENCA_OCSP_BIN
rc_status -v
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
rc_status
;;
force-reload)
$0 try-restart
rc_status
;;
reload|reload-crl)
## Reload the configured CRLs of ocsp
echo -n "Reload CRLs of ocsp "
/sbin/killproc -HUP $OPENCA_OCSP_BIN
rc_status -v
;;
status)
echo -n "Checking for service ocsp "
/sbin/checkproc $OPENCA_OCSP_BIN
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a restart, print out the
## argument to this init script which is required for a reload.
test $OPENCA_OCSP_CONFIG_FILE -nt $OPENCA_OCSP_PID && echo restart
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit