Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 086c311de3dada9f57eb2f5c6aacb4e4 > files > 13

openca-0.9.3-0.rc1.1mdv2008.0.src.rpm

#!/bin/sh
#
# openca	Startup script for the OpenCA daemon
#
# chkconfig: 345 85 15
# description: OpenCA daemon
# probe: false
# processname: openca
# pidfile: /var/lib/openca/tmp/xml_cache.pid
# pidfile: /var/lib/openca/tmp/openca_socket.pid
# config: /etc/openca/config.xml

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

[ -f /etc/openca/config.xml ] || exit 0

openca_start="/etc/openca/openca_start"
openca_stop="/etc/openca/openca_stop"
pidfile1="/var/lib/openca/tmp/xml_cache.pid"
pidfile2="/var/lib/openca/tmp/openca_socket.pid"
device_permissions="/etc/openca/device_permissions"

RETVAL=0

# See how we were called.
case "$1" in
  start)
        if ! [ -x $openca_start ]; then 
	    echo "OpenCA is unconfigured. Please edit the nessesary configuration files and then run"
	    echo "/usr/sbin/openca_bootstrap.sh."
	    exit 1
	fi
	echo -n "Starting OpenCA: "
	# OpenCA requires write permissions to devices such as floppy and cdrom
        if [ -f $device_permissions ]; then sh $device_permissions; fi
	$openca_start 2>/dev/null 1>&2 && success || failure
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/openca
	;;
  stop)
	echo -n "Shutting down OpenCA: "
	$openca_stop 2>/dev/null 1>&2 && success || failure
	# stopping OpenCA is sort of messy at this point...
	if [ -f ${pidfile1} ]; then kill -9 `cat ${pidfile1}` >/dev/null 2>&1; fi
	if [ -f ${pidfile2} ]; then kill -9 `cat ${pidfile2}` >/dev/null 2>&1; fi
	echo
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/openca
	rm -f ${pidfile1} ${pidfile2}
	rm -f /var/lib/openca/tmp/openca_socket
	rm -f /var/lib/openca/tmp/openca_xml_cache
	;;
  status)
	status $openca_start
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	echo "Usage: openca {start|stop|status|restart|reload}"
	exit 1
esac

exit $RETVAL