#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: nut_upsmon
# REQUIRE: NETWORKING nut
# BEFORE: LOGIN
# KEYWORD: shutdown

# Define these nut_upsmon* variables in one of these files:
#       /etc/rc.conf
#       /etc/rc.conf.local
#       /etc/rc.conf.d/nut_upsmon
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
nut_upsmon_enable=${nut_upsmon_enable:-"NO"}
nut_upsmon_prefix=${nut_upsmon_prefix:-"/usr/local"}

. /etc/rc.subr

name="nut_upsmon"
rcvar=nut_upsmon_enable

load_rc_config $name

required_dirs="/var/db/nut"
required_files="${nut_upsmon_prefix}/etc/nut/upsmon.conf"
command="${nut_upsmon_prefix}/sbin/upsmon"
pidfile="/var/db/nut/upsmon.pid"
nut_upsmon_flags=${nut_upsmon_flags:-"localhost"}

extra_commands=reload
stop_cmd="upsmon_stop"

reload()
{
	${command} -c reload
}

upsmon_stop()
{
	${command} -c stop
}

run_rc_command "$1"
