#! /bin/sh
# Copyright (c) 1995-2000 ???
#
# Author: Sandro Wefel  <wefel@informatik.uni-halle.de>
#
# Put it in /etc/rc2.d/ or /etc/rc3.d depending on runlevel
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

UPSDPATH=/usr/local/ups/sbin

# See how we are called.
case "$1" in
  'start')
    if [ -x $UPSDPATH/upsmon ]; then
       echo "NUT Starting UPS monitor "
       $UPSDPATH/upsmon >/dev/console 2>&1
       touch /var/lock/subsys/upsmon
    fi
    ;;        
  'stop')
    echo "NUT Stopping UPS monitor "
    /usr/bin/pkill -x upsmon
    rm -f /var/lock/subsys/upsmon
    ;;
  'restart')
    $0 stop
    $0 start
    ;;
  *)
    echo "Usage: upsmon {start|stop|restart}"
    exit 1
    ;;
esac
exit 0