14d52d
#!/bin/bash
14d52d
#
14d52d
# ods-signerd:         Starts the OpenDNSSEC Signer Daemon
14d52d
#
14d52d
# chkconfig: - 13 87
14d52d
# description:  ods-signerd is the OpenDNSSEC DNSSEC zone signer daemon
14d52d
# processname: /usr/sbin/ods-signerd
14d52d
# config: /etc/opendnssec/conf.xml
14d52d
#
14d52d
### BEGIN INIT INFO
14d52d
# Provides: ods-signerd
14d52d
# Required-Start: $local_fs $network $syslog
14d52d
# Required-Stop: $local_fs $network $syslog
14d52d
# Default-Stop: 0 11 89
14d52d
# Short-Description: start|stop|status|restart|try-restart|reload|force-reload OpenDNSSEC Signer Daemon
14d52d
# Description: control OpenDNSSEC signer daemon
14d52d
### END INIT INFO
14d52d
14d52d
# Init script default settings
14d52d
ODS_SIGNERD_CONF="/etc/opendnssec/conf.xml"
14d52d
ODS_SIGNERD_OPT=""
14d52d
ODS_SIGNERD_PROG="/usr/sbin/ods-signerd"
14d52d
ODS_SIGNER_PROG="/usr/sbin/ods-signer"
14d52d
ODS_SIGNERD_PIDFILE="/var/run/opendnssec/signerd.pid"
14d52d
PIDDIR="/var/run/opendnssec"
14d52d
14d52d
# Source function library.
14d52d
. /etc/rc.d/init.d/functions
14d52d
14d52d
[ -r /etc/sysconfig/ods ] && . /etc/sysconfig/ods
14d52d
14d52d
# Check that networking is configured.
14d52d
[ "${NETWORKING}" = "no" ] && exit 0
14d52d
14d52d
start() {
14d52d
  # Source networking configuration.
14d52d
  [ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
14d52d
14d52d
  # Check that networking is up
14d52d
  [ "${NETWORKING}" = "no" ] && exit 1
14d52d
14d52d
  # Sanity checks.
14d52d
  [ -f $ODS_SIGNERD_CONF ] || exit 5
14d52d
  [ -x $ODS_SIGNERD_PROG ] || exit 5
14d52d
  # /var/run could (and should) be tmpfs
14d52d
  [ -d $PIDDIR ] || mkdir -p $PIDDIR
14d52d
14d52d
  echo -n $"Starting ods-signerd:"
14d52d
# ods-signerd is lying about supporting -c conf.file option :(
14d52d
#  $ODS_SIGNERD_PROG -c $ODS_SIGNERD_CONF $ODS_SIGNERD_OPT
14d52d
  $ODS_SIGNERD_PROG $ODS_SIGNERD_OPT
14d52d
  RETVAL=$?
14d52d
        if [ $RETVAL -eq 0 ]; then
14d52d
           touch /var/lock/subsys/ods-signerd;
14d52d
           success
14d52d
           echo
14d52d
        else
14d52d
           failure
14d52d
           echo
14d52d
           exit 7;
14d52d
        fi
14d52d
  return 0;
14d52d
}
14d52d
14d52d
stop() {
14d52d
  echo -n $"Stopping ods-signerd: "
14d52d
  #$ODS_SIGNER_PROG -c $ODS_SIGNERD_CONF stop
14d52d
  # seems that this loses our settings :(
14d52d
  /usr/sbin/ods-signer stop
14d52d
  RETVAL=$?
14d52d
  [ "$RETVAL" -eq 0 ] || killproc $ODS_SIGNERD_PROG -TERM >/dev/null 2>&1
14d52d
  if [ $RETVAL -eq 0 ] ; then
14d52d
     rm -f $ODS_SIGNERD_PIDFILE
14d52d
     rm -f /var/lock/subsys/ods-signerd
14d52d
     success
14d52d
  else
14d52d
     failure
14d52d
  fi
14d52d
  echo
14d52d
  return $RETVAL
14d52d
}
14d52d
14d52d
restart() {
14d52d
	stop
14d52d
	start
14d52d
}
14d52d
14d52d
RETVAL=0
14d52d
14d52d
# See how we were called.
14d52d
case "$1" in
14d52d
  start)
14d52d
	start
14d52d
	;;
14d52d
  stop)
14d52d
	stop
14d52d
	;;
14d52d
  restart)
14d52d
	restart
14d52d
	;;
14d52d
  condrestart)
14d52d
        [ -f /var/lock/subsys/ods-signerd ] && restart || :
14d52d
	;;
14d52d
  status)
14d52d
	status -p $ODS_SIGNERD_PIDFILE $ODS_SIGNERD_PROG
14d52d
	;;
14d52d
  *)
14d52d
	echo $"Usage: $0 {start|stop|status|restart|condrestart}"
14d52d
	exit 1
14d52d
esac
14d52d
14d52d
exit $?