#!/bin/sh
# Startup script for the oppd(OpenPrinting japan StatusDaemon)
#
# chkconfig: 235 99 00
# description: Startup/shutdown script for the oppd(OpenPrinting japan StatusDaemon)
# processname: oppd-listen
# config: /etc/oppd.conf
# pidfile /var/run/oppd-listen.pid
# securlevel: 10

# Source function library
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi

if [ -f /etc/sysconfig/i18n ]; then
. /etc/sysconfig/i18n
fi

DAEMON=oppd-listen
OPPD_LOCK=/var/lock/subsys/oppd
CONF=/etc/oppd.conf

# See how we are called
case $1 in
    start)
      if [ -f ${OPPD_LOCK} ]; then
        action "${DAEMON} is running..." /bin/false
	exit 1
      fi
      ${DAEMON} < /dev/zero > /dev/null 2>&1 &
      ret=$? 
      if [ "$ret" = "0" ]; then
        touch ${OPPD_LOCK}
	action $"Starting ${DAEMON}: " /bin/true
      else
       	action $"Starting ${DAEMON}: " /bin/false
      fi	
      echo 
      ;;

    stop)
      echo -n "Shutting down ${DAEMON}: "
      killproc ${DAEMON}
      [ "$?" = "0" ] && rm -f ${OPPD_LOCK}
      echo
      ;;

    status)
      status ${DAEMON}
      ;;

    restart)
      $0 stop
      $0 start
      ;;

    reload)
      echo -n "Reloading ${DAEMON}: "
      killproc ${DAEMON} -HUP
      ;;

    *)
      echo "Usage: cups {start|stop|status|restart|reload}"
      exit 1
      ;;
esac
exit 0
