#!/bin/sh
### BEGIN INIT INFO
# Provides:          logger
# Required-Start:    $syslog $time $pesnet
# Required-Stop:     $syslog $time $pesnet
# Should-Start:      
# Default-Start:     2
# Default-Stop:
# Short-Description: Start logger.
# Description:       Start logger.
### END INIT INFO
PATH=/lib/init:/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions

DAEMON=/root/sql/logger
NAME=logger
PIDFILE=/var/run/$NAME.pid

case "$1" in
  start)
    log_action_msg "Starting logger"
    if ! start-stop-daemon --start --oknodo --quiet \
         --pidfile $PIDFILE --exec $DAEMON
      then
        rm -f $PIDFILE
        log_action_msg "Starting logger error"
    fi        
  ;;
  stop)
    log_action_msg "Stoping logger"
    if start-stop-daemon --stop --retry 30 --oknodo --quiet \
      --pidfile $PIDFILE --exec $DAEMON
    then
      rm -f $PIDFILE
    fi
  ;;  
  restart)
    $0 stop
    $0 start
  ;;
esac
