#!/bin/sh
#
# Startup script for Div server
#
# chkconfig: 345 85 15
# processname: div
# pidfile: /var/run/div.pid


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

# See how we were called.
case "$1" in
  start)
        echo -n "Starting Div: "
        cd /usr/local/div
        daemon /usr/local/div/divd.rb
        echo
        touch /var/lock/subsys/div
        ;;
  stop)
        echo -n "Shutting down div: "
        killproc /usr/local/div/divd.rb -INT
        sleep 3
        echo
        rm -f /var/lock/subsys/div
        rm -f /var/run/div.pid
        ;;
  status)
        status /usr/local/div/divd.rb
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac

exit 0
