diff options
author | wbx <wbx@hydrogenium.(none)> | 2009-05-17 14:41:34 +0200 |
---|---|---|
committer | wbx <wbx@hydrogenium.(none)> | 2009-05-17 14:41:34 +0200 |
commit | 219a6dab8995aad9ac4860cc1a84d6f3509a03a4 (patch) | |
tree | b9c0f3c43aebba2fcfef777592d0add39f2072f4 /package/nut/files |
Initial import
Diffstat (limited to 'package/nut/files')
-rw-r--r-- | package/nut/files/ups.conf | 104 | ||||
-rw-r--r-- | package/nut/files/upsd.conf | 42 | ||||
-rw-r--r-- | package/nut/files/upsd.init | 30 |
3 files changed, 176 insertions, 0 deletions
diff --git a/package/nut/files/ups.conf b/package/nut/files/ups.conf new file mode 100644 index 000000000..113394d5d --- /dev/null +++ b/package/nut/files/ups.conf @@ -0,0 +1,104 @@ +# Network UPS Tools: example ups.conf +# +# --- SECURITY NOTE --- +# +# If you use snmp-ups and set a community string in here, you +# will have to secure this file to keep other users from obtaining +# that string. It needs to be readable by upsdrvctl and any drivers, +# and by upsd. +# +# --- +# +# This is where you configure all the UPSes that this system will be +# monitoring directly. These are usually attached to serial ports, but +# USB devices and SNMP devices are also supported. +# +# This file is used by upsdrvctl to start and stop your driver(s), and +# is also used by upsd to determine which drivers to monitor. The +# drivers themselves also read this file for configuration directives. +# +# The general form is: +# +# [upsname] +# driver = <drivername> +# port = <portname> +# < any other directives here > +# +# The section header ([upsname]) can be just about anything as long as +# it is a single word inside brackets. upsd uses this to uniquely +# identify a UPS on this system. +# +# If you have a UPS called snoopy, your section header would be "[snoopy]". +# On a system called "doghouse", the line in your upsmon.conf to monitor +# it would look something like this: +# +# MONITOR snoopy@doghouse 1 upsmonuser mypassword master +# +# It might look like this if monitoring in slave mode: +# +# MONITOR snoopy@doghouse 1 upsmonuser mypassword slave +# +# Configuration directives +# ------------------------ +# +# These directives are common to all drivers that support ups.conf: +# +# driver: REQUIRED. Specify the program to run to talk to this UPS. +# apcsmart, fentonups, bestups, and sec are some examples. +# +# port: REQUIRED. The serial port where your UPS is connected. +# /dev/ttyS0 is usually the first port on Linux boxes, for example. +# +# sdorder: optional. When you have multiple UPSes on your system, you +# usually need to turn them off in a certain order. upsdrvctl +# shuts down all the 0s, then the 1s, 2s, and so on. To exclude +# a UPS from the shutdown sequence, set this to -1. +# +# The default value for this parameter is 0. +# +# nolock: optional, and not recommended for use in this file. +# +# If you put nolock in here, the driver will not lock the +# serial port every time it starts. This may allow other +# processes to seize the port if you start more than one by +# mistake. +# +# This is only intended to be used on systems where locking +# absolutely must be disabled for the software to work. +# +# maxstartdelay: optional. This can be set as a global variable +# above your first UPS definition and it can also be +# set in a UPS section. This value controls how long +# upsdrvctl will wait for the driver to finish starting. +# This keeps your system from getting stuck due to a +# broken driver or UPS. +# +# The default is 45 seconds. +# +# +# Anything else is passed through to the hardware-specific part of +# the driver. +# +# Examples +# -------- +# +# A simple example for a UPS called "powerpal" that uses the fentonups +# driver on /dev/ttyS0 is: +# +# [powerpal] +# driver = fentonups +# port = /dev/ttyS0 +# desc = "Web server" +# +# If your UPS driver requires additional settings, you can specify them +# here. For example, if it supports a setting of "1234" for the +# variable "cable", it would look like this: +# +# [myups] +# driver = mydriver +# port = /dev/ttyS1 +# cable = 1234 +# desc = "Something descriptive" +# +# To find out if your driver supports any extra settings, start it with +# the -h option and/or read the driver's documentation. diff --git a/package/nut/files/upsd.conf b/package/nut/files/upsd.conf new file mode 100644 index 000000000..c165cfcf5 --- /dev/null +++ b/package/nut/files/upsd.conf @@ -0,0 +1,42 @@ +# Network UPS Tools: example upsd configuration file +# +# This file contains access control data, you should keep it secure. +# +# It should only be readable by the user that upsd becomes. See the FAQ. + +# ======================================================================= +# Access Control Lists (ACLs) +# +# ACL <name> <ipblock> +# ACL myhost 10.0.0.1/32 +# +# ACCEPT <aclname> [<aclname>...] +# REJECT <aclname> [<aclname>...] +# +# Define lists of hosts or networks with ACL definitions. +# +# ACCEPT and REJECT use ACL definitions to control whether a host is +# allowed to connect to upsd. +# +# This default configuration only gives access to localhost. To allow +# other hosts or networks to connect, see the documentation and change +# these lines. + +ACL all 0.0.0.0/0 +ACL localhost 127.0.0.1/32 + +ACCEPT localhost +REJECT all + +# ======================================================================= +# MAXAGE <seconds> +# MAXAGE 15 +# +# This defaults to 15 seconds. After a UPS driver has stopped updating +# the data for this many seconds, upsd marks it stale and stops making +# that information available to clients. After all, the only thing worse +# than no data is bad data. +# +# You should only use this if your driver has difficulties keeping +# the data fresh within the normal 15 second interval. Watch the syslog +# for notifications from upsd about staleness. diff --git a/package/nut/files/upsd.init b/package/nut/files/upsd.init new file mode 100644 index 000000000..e3afadbba --- /dev/null +++ b/package/nut/files/upsd.init @@ -0,0 +1,30 @@ +#!/bin/sh +#FWINIT 60 +. /etc/rc.conf + +case $1 in +autostop) ;; +autostart) + test x"${upsd:-NO}" = x"NO" && exit 0 + exec sh $0 start + ;; +start) + [ -d /var/state/ups ] || mkdir -p /var/state/ups + /usr/bin/upsdrvctl start || exit 1 + /usr/sbin/upsd || exit 2 + ;; +stop) + /usr/sbin/upsd -c stop || killall upsd + /usr/bin/upsdrvctl stop + ;; +restart) + sh $0 stop + sleep 1 + sh $0 start + ;; +*) + echo "Usage: $0 {start | stop | restart}" + exit 1 + ;; +esac +exit $? |