#! /bin/sh
# Copyright (c) 1995-2000 ???
#
# Author: Sandro Wefel  <wefel@informatik.uni-halle.de>
#
# init.d/upsmon
#
#   and symbolic its link
#
# /sbin/upsmon
#
# System startup script for the upsmon
#
### BEGIN INIT INFO
# Provides: upsmon
# Required-Start: upsd network route
# Required-Stop:  
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Description:    Start upsmon
### END INIT INFO

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

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

# Source SuSE config
. /etc/rc.config

UPSDPATH=/usr/local/ups/sbin

rc_reset

# See how we are called.
case "$1" in
  start)
	echo -n "NUT Starting UPS monitor" 
	startproc $UPSDPATH/upsmon || return=$rc_failed 
	touch /var/lock/subsys/upsmon
	rc_status -v
	;;
  stop)
	echo -n "NUT Stopping UPS monitor: "
	killproc $UPSDPATH/upsmon
	rm -f /var/lock/subsys/upsmon
	rc_status -v
	;;
  restart)
	$0 stop
	$0 start
	rc_status
	;;
  status)
	checkproc $UPSDPATH/upsmon; rc=$?
	if test $rc = 0; then echo "OK $UPSDPATH/upsmon"
	else echo "No process $UPSDPATH/upsmon" 
	fi
	;;
  *)
	echo "Usage: upsmon {start|stop|restart|status}"
	exit 1
esac
rc_exit
