initial commit of file from CVS for e-smith-nutUPS on Wed 12 Jul 09:01:20 BST 2023
This commit is contained in:
parent
d9332aba34
commit
667523a800
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.rpm
|
||||
*.log
|
||||
*spec-20*
|
||||
*.tar.xz
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
# Makefile for source rpm: e-smith-nutUPS
|
||||
# $Id: Makefile,v 1.1 2016/02/05 22:19:01 stephdl Exp $
|
||||
NAME := e-smith-nutUPS
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
16
README.md
16
README.md
@ -1,3 +1,17 @@
|
||||
# e-smith-nutUPS
|
||||
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> e-smith-nutUPS
|
||||
|
||||
SMEServer Koozali developed git repo for e-smith-nutUPS smeserver
|
||||
|
||||
## Wiki
|
||||
<br />https://wiki.koozali.org/
|
||||
|
||||
## Bugzilla
|
||||
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=e-smith-nutUPS&product=SME%20Server%2010.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||
|
||||
## Description
|
||||
|
||||
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
|
||||
*Once it has been checked, then this comment will be deleted*
|
||||
<br />
|
||||
|
||||
e-smith-nutUPS is an open-source software designed to monitor and control an Uninterruptible Power Supply (UPS) device connected to a computer. It offers features such as automatic shutdown of the computer when the UPS battery reaches a critical low-power level, and the capability to remotely monitor and control the UPS from a web browser or from a command line interface. It supports a wide range of UPS devices, and is compatible with most operating systems. With e-smith-nutUPS, users can be assured of reliable and consistent power protection even during power outages.
|
||||
|
29
additional/config/hosts.conf
Normal file
29
additional/config/hosts.conf
Normal file
@ -0,0 +1,29 @@
|
||||
# Network UPS Tools: example hosts.conf
|
||||
#
|
||||
# This file is used to control the CGI programs. If you have not
|
||||
# installed them, you may safely ignore or delete this file.
|
||||
#
|
||||
# -----------------------------------------------------------------------
|
||||
#
|
||||
# upsstats will use the list of MONITOR entries when displaying the
|
||||
# default template (upsstats.html). The "FOREACHUPS" directive in the
|
||||
# template will use this file to find systems running upsd.
|
||||
#
|
||||
# upsstats and upsimage also use this file to determine if a host may be
|
||||
# monitored. This keeps evil people from using your system to annoy
|
||||
# others with unintended queries.
|
||||
#
|
||||
# upsset presents a list of systems that may be viewed and controlled
|
||||
# using this file.
|
||||
#
|
||||
# -----------------------------------------------------------------------
|
||||
#
|
||||
# Usage: list systems running upsd that you want to monitor
|
||||
#
|
||||
# MONITOR <system> "<host description>"
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# MONITOR myups@localhost "Local UPS"
|
||||
# MONITOR su2200@10.64.1.1 "Finance department"
|
||||
# MONITOR matrix@shs-server.example.edu "Sierra High School data room #1"
|
93
additional/config/ups.conf
Normal file
93
additional/config/ups.conf
Normal file
@ -0,0 +1,93 @@
|
||||
# Network UPS Tools: example ups.conf
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# To find out if your driver supports any extra settings, start it with
|
||||
# with the -h option and/or read the driver's documentation.
|
43
additional/config/upsd.conf
Normal file
43
additional/config/upsd.conf
Normal file
@ -0,0 +1,43 @@
|
||||
# Network UPS Tools: example upsd configuration file
|
||||
#
|
||||
# This file contains passwords, so you should keep it secure.
|
||||
#
|
||||
# At the very least it should be owned by root, with mode 0600.
|
||||
#
|
||||
# If you want upsd to be able to reload the configuration files, this
|
||||
# file must be readable by whatever user upsd becomes. See the FAQ.
|
||||
|
||||
# =======================================================================
|
||||
# Access Control Lists (ACLs)
|
||||
#
|
||||
# ACL <name> <ipblock>
|
||||
# ACL myhost 10.0.0.1/32
|
||||
#
|
||||
# ACCESS <action> <level> <aclname> [<password>]
|
||||
# ACCESS grant login myhost mypass
|
||||
#
|
||||
# Use these to define blocks of addresses. See the upsd.conf(5) man page
|
||||
# for more information.
|
||||
#
|
||||
# This default configuration allows localhost to monitor things and denies
|
||||
# access to the rest of the world. To allow more, see the docs and
|
||||
# change these lines.
|
||||
|
||||
ACL all 0.0.0.0/0
|
||||
ACL localhost 127.0.0.1/32
|
||||
|
||||
ACCESS grant monitor localhost
|
||||
ACCESS deny all 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.
|
74
additional/config/upsd.users
Normal file
74
additional/config/upsd.users
Normal file
@ -0,0 +1,74 @@
|
||||
# Network UPS Tools: Example upsd.users
|
||||
#
|
||||
# This file sets the permissions for upsd - the UPS network daemon.
|
||||
# Users are defined here, are given passwords, and their privileges are
|
||||
# controlled here too. Since this file will contain passwords, keep it
|
||||
# secure, with only enough permissions for upsd to read it.
|
||||
#
|
||||
# At the very least it should be owned by root, with mode 0600.
|
||||
#
|
||||
# If you want upsd to be able to reload the configuration files, this
|
||||
# file must be readable by whatever user upsd becomes. See the FAQ.
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
# Each user gets a section. To start a section, put the username in
|
||||
# brackets on a line by itself. To set something for that user, specify
|
||||
# it under that section heading. The username is case-sensitive, so
|
||||
# admin and AdMiN are two different users.
|
||||
#
|
||||
# Possible settings:
|
||||
#
|
||||
# password: The user's password. This is case-sensitive.
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# allowfrom: ACL names that this user may connect from. ACLs are
|
||||
# defined in upsd.conf.
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# actions: Let the user do certain things with upsd.
|
||||
#
|
||||
# Valid actions are:
|
||||
#
|
||||
# SET - change the value of certain variables in the UPS
|
||||
# FSD - set the "forced shutdown" flag in the UPS
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# instcmds: Let the user initiate specific instant commands. Use "ALL"
|
||||
# to grant all commands automatically. Here are a few instant
|
||||
# commands. For the full list, see include/shared-tables.h.
|
||||
#
|
||||
# FPTEST - Front panel test
|
||||
# BTEST0 - Stop battery test
|
||||
# BTEST1 - Start battery test
|
||||
# CAL0 - Stop calibration
|
||||
# CAL1 - Start calibration
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# [admin]
|
||||
# password = mypass
|
||||
# allowfrom = admworkstation admhome
|
||||
# actions = SET
|
||||
# instcmds = ALL
|
||||
#
|
||||
|
||||
#
|
||||
# --- Configuring for upsmon
|
||||
#
|
||||
# To add a user for your upsmon, use this example:
|
||||
#
|
||||
# [monuser]
|
||||
# password = pass
|
||||
# allowfrom = bigserver
|
||||
#
|
||||
# upsmon master (or upsmon slave)
|
||||
#
|
||||
# The matching MONITOR line in your upsmon.conf would look like this:
|
||||
#
|
||||
# MONITOR myups@myhost 1 monuser pass slave
|
287
additional/config/upsmon.conf
Normal file
287
additional/config/upsmon.conf
Normal file
@ -0,0 +1,287 @@
|
||||
# Network UPS Tools: example upsmon configuration
|
||||
#
|
||||
# This file contains passwords, so keep it secure.
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# RUN_AS_USER <userid>
|
||||
#
|
||||
# By default, upsmon splits into two processes. One stays as root and
|
||||
# waits to run the SHUTDOWNCMD. The other one switches to another userid
|
||||
# and does everything else.
|
||||
#
|
||||
# The default nonprivileged user is set at compile-time with
|
||||
# 'configure --with-user=...'.
|
||||
#
|
||||
# You can override it with '-u <user>' when starting upsmon, or just
|
||||
# define it here for convenience.
|
||||
#
|
||||
# Note: if you plan to use the reload feature, this file (upsmon.conf)
|
||||
# must be readable by this user! Since it contains passwords, DO NOT
|
||||
# make it world-readable. Also, do not make it writable by the upsmon
|
||||
# user, since it creates an opportunity for an attack by changing the
|
||||
# SHUTDOWNCMD to something malicious.
|
||||
#
|
||||
# For best results, you should create a new normal user like "nutmon",
|
||||
# then specify it here and make it the owner of your upsmon.conf, then
|
||||
# set the mode on upsmon.conf to 0400.
|
||||
#
|
||||
# RUN_AS_USER nutmon
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# MONITOR <system> <powervalue> <username> <password> ("master"|"slave")
|
||||
#
|
||||
# List systems you want to monitor. Not all of these may supply power
|
||||
# to the system running upsmon, but if you want to watch it, it has to
|
||||
# be in this section.
|
||||
#
|
||||
# You must have at least one of these declared.
|
||||
#
|
||||
# <system> is a UPS identifier in the form [<upsname>@]<hostname>[:<port>]
|
||||
# like localhost, su700@mybox, etc.
|
||||
#
|
||||
# Simple entry:
|
||||
#
|
||||
# - "localhost" refers to the first UPS on the local system.
|
||||
#
|
||||
# Other possibilities:
|
||||
#
|
||||
# - "su700@mybox" means a UPS called "su700" on a system called "mybox"
|
||||
#
|
||||
# - "elvis:1234" means the first UPS on a system called "elvis", port 1234.
|
||||
#
|
||||
# Finally, to use all of these options:
|
||||
#
|
||||
# - "fenton@bigbox:5678" is a UPS called "fenton" on a system called
|
||||
# "bigbox" which runs upsd on port "5678". Phew!
|
||||
#
|
||||
# The UPS names like "su700" and "fenton" are set in your ups.conf
|
||||
# in [brackets] which identify a section for a particular driver.
|
||||
#
|
||||
# If the ups.conf on host "doghouse" has a section called "snoopy", the
|
||||
# identifier for it would be "snoopy@doghouse".
|
||||
#
|
||||
# <powervalue> is an integer - the number of power supplies that this UPS
|
||||
# feeds on this system. Most computers only have one power supply, so this
|
||||
# is normally set to 1. You need a pretty big or special box to have any
|
||||
# other value here.
|
||||
#
|
||||
# You can also set this to 0 for a system that doesn't supply any power,
|
||||
# but you still want to monitor. Use this when you want to hear about
|
||||
# changes for a given UPS without shutting down when it goes critical.
|
||||
#
|
||||
# <username> and <password> must match an entry in that system's
|
||||
# upsd.users. If your username is "monmaster" and your password is
|
||||
# "blah", the upsd.users would look like this:
|
||||
#
|
||||
# [monmaster]
|
||||
# password = blah
|
||||
# allowfrom = (whatever applies to this host)
|
||||
# upsmon master (or slave)
|
||||
#
|
||||
# "master" means this system will shutdown last, allowing the slaves
|
||||
# time to shutdown first.
|
||||
#
|
||||
# "slave" means this system shuts down immediately when power goes critical.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# MONITOR myups@bigserver 1 monmaster blah master
|
||||
# MONITOR su700@server.example.com 1 upsmon secretpass slave
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# MINSUPPLIES <num>
|
||||
#
|
||||
# Give the number of power supplies that must be receiving power to keep
|
||||
# this system running. Most systems have one power supply, so you would
|
||||
# put "1" in this field.
|
||||
#
|
||||
# Large/expensive server type systems usually have more, and can run with
|
||||
# a few missing. The HP NetServer LH4 can run with 2 out of 4, for example,
|
||||
# so you'd set that to 2. The idea is to keep the box running as long
|
||||
# as possible, right?
|
||||
#
|
||||
# Obviously you have to put the redundant supplies on different UPS circuits
|
||||
# for this to make sense! See big-servers.txt in the docs subdirectory
|
||||
# for more information and ideas on how to use this feature.
|
||||
|
||||
MINSUPPLIES 1
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# SHUTDOWNCMD "<command>"
|
||||
#
|
||||
# upsmon runs this command when the system needs to be brought down.
|
||||
#
|
||||
# This should work just about everywhere ... if it doesn't, well, change it.
|
||||
|
||||
SHUTDOWNCMD "/sbin/shutdown -h +0"
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# NOTIFYCMD <command>
|
||||
#
|
||||
# upsmon calls this to send messages when things happen
|
||||
#
|
||||
# This command is called with the full text of the message as one argument.
|
||||
# The environment string NOTIFYTYPE will contain the type string of
|
||||
# whatever caused this event to happen.
|
||||
#
|
||||
# Note that this is only called for NOTIFY events that have EXEC set with
|
||||
# NOTIFYFLAG. See NOTIFYFLAG below for more details.
|
||||
#
|
||||
# Making this some sort of shell script might not be a bad idea. For more
|
||||
# information and ideas, see pager.txt in the docs directory.
|
||||
#
|
||||
# Example:
|
||||
# NOTIFYCMD /usr/local/ups/bin/notifyme
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# POLLFREQ <n>
|
||||
#
|
||||
# Polling frequency for normal activities, measured in seconds.
|
||||
#
|
||||
# Adjust this to keep upsmon from flooding your network, but don't make
|
||||
# it too high or it may miss certain short-lived power events.
|
||||
|
||||
POLLFREQ 5
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# POLLFREQALERT <n>
|
||||
#
|
||||
# Polling frequency in seconds while UPS on battery.
|
||||
#
|
||||
# You can make this number lower than POLLFREQ, which will make updates
|
||||
# faster when any UPS is running on battery. This is a good way to tune
|
||||
# network load if you have a lot of these things running.
|
||||
#
|
||||
# The default is 5 seconds for both this and POLLFREQ.
|
||||
|
||||
POLLFREQALERT 5
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# HOSTSYNC - How long upsmon will wait before giving up on another upsmon
|
||||
#
|
||||
# The master upsmon process uses this number when waiting for slaves to
|
||||
# disconnect once it has set the forced shutdown (FSD) flag. If they
|
||||
# don't disconnect after this many seconds, it goes on without them.
|
||||
#
|
||||
# Similarly, upsmon slave processes wait up to this interval for the
|
||||
# master upsmon to set FSD when a UPS they are monitoring goes critical -
|
||||
# that is, on battery and low battery. If the master doesn't do its job,
|
||||
# the slaves will shut down anyway to avoid damage to the file systems.
|
||||
#
|
||||
# This "wait for FSD" is done to avoid races where the status changes
|
||||
# to critical and back between polls by the master.
|
||||
|
||||
HOSTSYNC 15
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# DEADTIME - Interval to wait before declaring a stale ups "dead"
|
||||
#
|
||||
# upsmon requires a UPS to provide status information every few seconds
|
||||
# (see POLLFREQ and POLLFREQALERT) to keep things updated. If the status
|
||||
# fetch fails, the UPS is marked stale. If it stays stale for more than
|
||||
# DEADTIME seconds, the UPS is marked dead.
|
||||
#
|
||||
# A dead UPS that was last known to be on battery is assumed to have gone
|
||||
# to a low battery condition. This may force a shutdown if it is providing
|
||||
# a critical amount of power to your system.
|
||||
#
|
||||
# Note: DEADTIME should be a multiple of POLLFREQ and POLLFREQALERT.
|
||||
# Otherwise you'll have "dead" UPSes simply because upsmon isn't polling
|
||||
# them quickly enough. Rule of thumb: take the larger of the two
|
||||
# POLLFREQ values, and multiply by 3.
|
||||
|
||||
DEADTIME 15
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# POWERDOWNFLAG - Flag file for forcing UPS shutdown on the master system
|
||||
#
|
||||
# upsmon will create a file with this name in master mode when it's time
|
||||
# to shut down the load. You should check for this file's existence in
|
||||
# your shutdown scripts and run 'upsdrvctl shutdown' if it exists.
|
||||
#
|
||||
# See the shutdown.txt file in the docs subdirectory for more information.
|
||||
|
||||
POWERDOWNFLAG /etc/killpower
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# NOTIFYMSG - change messages sent by upsmon when certain events occur
|
||||
#
|
||||
# You can change the stock messages to something else if you like.
|
||||
#
|
||||
# NOTIFYMSG <notify type> "message"
|
||||
#
|
||||
# NOTIFYMSG ONLINE "UPS %s is getting line power"
|
||||
# NOTIFYMSG ONBATT "Someone pulled the plug on %s"
|
||||
#
|
||||
# Note that %s is replaced with the identifier of the UPS in question.
|
||||
#
|
||||
# Possible values for <notify type>:
|
||||
#
|
||||
# ONLINE : UPS is back online
|
||||
# ONBATT : UPS is on battery
|
||||
# LOWBATT : UPS has a low battery (if also on battery, it's "critical")
|
||||
# FSD : UPS is being shutdown by the master (FSD = "Forced Shutdown")
|
||||
# COMMOK : Communications established with the UPS
|
||||
# COMMBAD : Communications lost to the UPS
|
||||
# SHUTDOWN : The system is being shutdown
|
||||
# REPLBATT : The UPS battery is bad and needs to be replaced
|
||||
# NOCOMM : A UPS is unavailable (can't be contacted for monitoring)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# NOTIFYFLAG - change behavior of upsmon when NOTIFY events occur
|
||||
#
|
||||
# By default, upsmon sends walls (global messages to all logged in users)
|
||||
# and writes to the syslog when things happen. You can change this.
|
||||
#
|
||||
# NOTIFYFLAG <notify type> <flag>[+<flag>][+<flag>] ...
|
||||
#
|
||||
# NOTIFYFLAG ONLINE SYSLOG
|
||||
# NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
|
||||
#
|
||||
# Possible values for the flags:
|
||||
#
|
||||
# SYSLOG - Write the message in the syslog
|
||||
# WALL - Write the message to all users on the system
|
||||
# EXEC - Execute NOTIFYCMD (see above) with the message
|
||||
# IGNORE - Don't do anything
|
||||
#
|
||||
# If you use IGNORE, don't use any other flags on the same line.
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# RBWARNTIME - replace battery warning time in seconds
|
||||
#
|
||||
# upsmon will normally warn you about a battery that needs to be replaced
|
||||
# every 43200 seconds, which is 12 hours. It does this by triggering a
|
||||
# NOTIFY_REPLBATT which is then handled by the usual notify structure
|
||||
# you've defined above.
|
||||
#
|
||||
# If this number is not to your liking, override it here.
|
||||
|
||||
RBWARNTIME 43200
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# NOCOMMWARNTIME - no communications warning time in seconds
|
||||
#
|
||||
# upsmon will let you know through the usual notify system if it can't
|
||||
# talk to any of the UPS entries that are defined in this file. It will
|
||||
# trigger a NOTIFY_NOCOMM by default every 300 seconds unless you
|
||||
# change the interval with this directive.
|
||||
|
||||
NOCOMMWARNTIME 300
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# FINALDELAY - last sleep interval before shutting down the system
|
||||
#
|
||||
# On a master, upsmon will wait this long after sending the NOTIFY_SHUTDOWN
|
||||
# before executing your SHUTDOWNCMD. If you need to do something in between
|
||||
# those events, increase this number. Remember, at this point your UPS is
|
||||
# almost depleted, so don't make this too high.
|
||||
#
|
||||
# Alternatively, you can set this very low so you don't wait around when
|
||||
# it's time to shut down. Some UPSes don't give much warning for low
|
||||
# battery and will require a value of 0 here for a safe shutdown.
|
||||
#
|
||||
# Note: If FINALDELAY on the slave is greater than HOSTSYNC on the master,
|
||||
# the master will give up waiting for the slave to disconnect.
|
||||
|
||||
FINALDELAY 5
|
95
additional/config/upssched.conf
Normal file
95
additional/config/upssched.conf
Normal file
@ -0,0 +1,95 @@
|
||||
# Network UPS Tools - upssched.conf sample file
|
||||
#
|
||||
# ============================================================================
|
||||
#
|
||||
# CMDSCRIPT <scriptname>
|
||||
#
|
||||
# This script gets called to invoke commands for timers that trigger.
|
||||
# It is given a single argument - the <timername> in your
|
||||
# AT ... START-TIMER defines.
|
||||
#
|
||||
# *** This must be defined *before* the first AT line. Otherwise the
|
||||
# program will complain and exit without doing anything.
|
||||
#
|
||||
# A shell script with a big case..esac construct should work nicely for this.
|
||||
# An example has been provided to help you get started.
|
||||
|
||||
CMDSCRIPT /usr/sbin/upssched-cmd
|
||||
|
||||
# ============================================================================
|
||||
#
|
||||
# PIPEFN <filename>
|
||||
#
|
||||
# This sets the file name of the FIFO that will pass communications between
|
||||
# processes to start and stop timers. This should be set to some path where
|
||||
# normal users can't create the file, due to the possibility of symlinking
|
||||
# and other evil.
|
||||
#
|
||||
# NOTE: if you are running Solaris or similar, the permissions that upssched
|
||||
# sets on this file *are not enough* to keep you safe. If your OS ignores
|
||||
# the permissions on a FIFO, then you MUST put this in a protected directory!
|
||||
#
|
||||
# Another thing to think about: upsmon doesn't run the NOTIFYCMD as root
|
||||
# unless you run it with -p. So, upssched will probably run as nobody
|
||||
# or similar unless you give upsmon another user with -u. Either way,
|
||||
# you have to set PIPEFN to something that ONLY the resulting upsmon
|
||||
# user can access.
|
||||
#
|
||||
# This is commented out by default to make you visit this file and think
|
||||
# about how your system works before potentially opening a hole.
|
||||
#
|
||||
# PIPEFN /var/run/upssched.pipe
|
||||
|
||||
# ============================================================================
|
||||
#
|
||||
# AT <notifytype> <upsname> <command>
|
||||
#
|
||||
# Define a handler for a specific event <notifytype> on UPS <upsname>.
|
||||
#
|
||||
# <upsname> can be the special value * to apply this handler to every
|
||||
# possible value of <upsname>.
|
||||
#
|
||||
# Run the command <command> via your CMDSCRIPT when it happens.
|
||||
#
|
||||
# Note that any AT that matches both the <notifytype> and the <upsname>
|
||||
# for the current event will be used.
|
||||
|
||||
# ============================================================================
|
||||
#
|
||||
# Possible AT commands
|
||||
#
|
||||
# - START-TIMER <timername> <interval>
|
||||
#
|
||||
# Start a timer called <timername> that will trigger after <interval>
|
||||
# seconds, calling your CMDSCRIPT with <timername> as the first
|
||||
# argument.
|
||||
#
|
||||
# Example:
|
||||
# Start a timer that'll execute when any UPS (*) has been gone 10 seconds
|
||||
#
|
||||
# AT COMMBAD * START-TIMER upsgone 10
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
#
|
||||
# - CANCEL-TIMER <timername> [cmd]
|
||||
#
|
||||
# Cancel a running timer called <timername>, if possible. If the timer
|
||||
# has passed then pass the optional argument <cmd> to CMDSCRIPT.
|
||||
#
|
||||
# Example:
|
||||
# If a specific UPS (myups@localhost) comes back online, then stop the
|
||||
# timer before it triggers
|
||||
#
|
||||
# AT COMMOK myups@localhost CANCEL-TIMER upsgone
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
#
|
||||
# - EXECUTE <command>
|
||||
#
|
||||
# Immediately pass <command> as an argument to CMDSCRIPT.
|
||||
#
|
||||
# Example:
|
||||
# If any UPS (*) reverts to utility power, then execute
|
||||
# 'ups-back-on-line' via CMDSCRIPT.
|
||||
#
|
||||
# AT ONLINE * EXECUTE ups-back-on-line
|
36
additional/config/upsset.conf
Normal file
36
additional/config/upsset.conf
Normal file
@ -0,0 +1,36 @@
|
||||
# Network UPS Tools - upsset.conf sample file
|
||||
#
|
||||
# This file is provided to ensure that you do not expose your upsd server
|
||||
# to the world upon installing the CGI programs. Specifically, it keeps
|
||||
# the upsset.cgi program from running until you have assured it that you
|
||||
# have secured your web server's CGI directory.
|
||||
#
|
||||
# By default, your web server will probably let anyone access upsset.cgi
|
||||
# once it is installed. This means that anyone could attempt to crack
|
||||
# upsd logins since they would appear to be coming from your web server,
|
||||
# rather than the outside world, slipping through any ACL/ACCESS definitions.
|
||||
#
|
||||
# For this reason, you *MUST* first secure your CGI programs before
|
||||
# enabling upsset in this configuration file. If you can't do this in
|
||||
# your web server, then you should *not* run this program.
|
||||
#
|
||||
# For Apache, the .htaccess file can be used in the directory with the
|
||||
# programs. You'll need something like this:
|
||||
#
|
||||
# <Files upsset.cgi>
|
||||
# deny from all
|
||||
# allow from your.network.addresses
|
||||
# </Files>
|
||||
#
|
||||
# You will probably have to set "AllowOverride Limit" for this directory in
|
||||
# your server-level configuration file as well.
|
||||
#
|
||||
# If this doesn't make sense, then stop reading and leave this program alone.
|
||||
#
|
||||
# Assuming you have all this done (and it works), then you may uncomment
|
||||
# the line below and start using upsset.cgi through your web browser.
|
||||
#
|
||||
|
||||
###
|
||||
### I_HAVE_SECURED_MY_CGI_DIRECTORY
|
||||
###
|
1
contriborbase
Normal file
1
contriborbase
Normal file
@ -0,0 +1 @@
|
||||
sme10
|
24
createlinks
Normal file
24
createlinks
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use esmith::Build::CreateLinks qw(:all);
|
||||
|
||||
my @events = qw(bootstrap-console-save console-save post-install post-upgrade e-smith-nutUPS-update);
|
||||
|
||||
templates2events("/etc/sysconfig/ups", @events);
|
||||
templates2events("/usr/lib/systemd/system/nut-server.service.d/50koozali.conf", @events);
|
||||
templates2events("/usr/lib/systemd/system/nut-monitor.service.d/50koozali.conf", @events);
|
||||
|
||||
foreach (qw(ups.conf upsd.users upsmon.conf upssched.conf))
|
||||
{
|
||||
templates2events("/etc/ups/$_", @events);
|
||||
}
|
||||
|
||||
foreach (qw(bootstrap-console-save console-save e-smith-nutUPS-update))
|
||||
{
|
||||
templates2events("/etc/ups/upsd.conf", $_);
|
||||
}
|
||||
|
||||
my $event="e-smith-nutUPS-update";
|
||||
safe_symlink("try-restart", "root/etc/e-smith/events/$event/services2adjust/nut");
|
||||
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event);
|
||||
event_link("systemd-default", $event, "06");
|
316
e-smith-nutUPS.spec
Normal file
316
e-smith-nutUPS.spec
Normal file
@ -0,0 +1,316 @@
|
||||
# $Id: e-smith-nutUPS.spec,v 1.16 2022/12/26 03:29:15 jpp Exp $
|
||||
|
||||
Summary: SME server - nut UPS interaction module
|
||||
%define name e-smith-nutUPS
|
||||
Name: %{name}
|
||||
%define version 2.6.0
|
||||
%define release 14
|
||||
Version: %{version}
|
||||
Release: %{release}%{?dist}
|
||||
License: GPL
|
||||
Group: Networking/Daemons
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
|
||||
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||
Requires: nut nut-client daemontools
|
||||
Obsoletes: neon <= 0.25.5
|
||||
Requires: e-smith-lib >= 1.15.1-16
|
||||
BuildArchitectures: noarch
|
||||
BuildRequires: e-smith-devtools
|
||||
AutoReqProv: no
|
||||
|
||||
%description
|
||||
A module which configures the Network UPS Tools suite for operation with
|
||||
the SME server software.
|
||||
|
||||
%changelog
|
||||
* Wed Jul 12 2023 cvs2git.sh aka Brian Read <brianr@koozali.org> 2.6.0-14.sme
|
||||
- Roll up patches and move to git repo [SME: 12338]
|
||||
|
||||
* Wed Jul 12 2023 BogusDateBot
|
||||
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||
by assuming the date is correct and changing the weekday.
|
||||
|
||||
* Sun Dec 25 2022 Jean-Philippe Pialasse <tests@pialasse.com> 2.6.0-13.sme
|
||||
- fix server failing if set as netserver [SME: 12287]
|
||||
- remove log noise for tmp files
|
||||
|
||||
* Mon Jun 21 2021 Terry Fage <tfage@yahoo.com.au> 2.6.0-12.sme
|
||||
- Misspelling in /usr/lib/systemd/system/nut.service file [SME: 11633]
|
||||
|
||||
* Tue Mar 30 2021 Terry Fage <tfage@yahoo.com.au> 2.6.0-11.sme
|
||||
- fix start ordering nut.service [SME: 11488]
|
||||
|
||||
* Sat Mar 27 2021 Terry Fage <tfage@yahoo.com.au> 2.6.0-10.sme
|
||||
- fix ExecStartPre path for /usr/lib/tmpfiles.d/nut-run.conf [SME: 11488]
|
||||
|
||||
* Thu Mar 25 2021 Terry Fage <tfage@yahoo.com.au> 2.6.0-9.sme
|
||||
- fix ExecStartPre path for nut.service [SME: 11488]
|
||||
|
||||
* Mon Dec 07 2020 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-8.sme
|
||||
- fix template path for monitor [SME: 9423]
|
||||
|
||||
* Sun Nov 29 2020 John Crisp <jcrisp@safeandsoundit.co.uk> 2.6.0-6.sme
|
||||
- Fix preset line endings in 49-koozali.preset [SME: 11215]
|
||||
|
||||
* Wed Nov 18 2020 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-5.sme
|
||||
- add update event to avoid reboot [SME: 11146]
|
||||
- adapt nut UPS for systemd [SME: 9423]
|
||||
|
||||
* Fri Feb 05 2016 stephane de Labrusse <stephdl@de-labrusse.fr> 2.6.0-2.sme
|
||||
- Initial release to sme10
|
||||
|
||||
* Sat Feb 07 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-9.sme
|
||||
- Allow the admin upsd in /etc/hosts.allow [SME: 8826]
|
||||
|
||||
* Tue Feb 03 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-7.sme
|
||||
- Creation Admin Privilege for use of upscmd & upsrw [SME: 8826]
|
||||
- Remove obsolete directives {allowfrom} [SME: 8793]
|
||||
|
||||
* Sun Jan 25 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-5.sme
|
||||
- Access property created (default value is 'localhost') [SME: 8793]
|
||||
|
||||
* Thu Jan 22 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 2.4.0-3.sme
|
||||
- Remove obsolete directives {ACL,ACCEPT,REJECT} and switch to LISTEN
|
||||
- in /etc/ups/upsd.conf
|
||||
- Allow NUT in /etc/hosts.allow and in /etc/services [SME: 8793]
|
||||
- Code change from Daniel B.<daniel@firewall-services.com>
|
||||
|
||||
* Thu Jan 31 2013 Shad L. Lords <slords@mail.com> 2.4.0-2.sme
|
||||
- Obsolete el5 packages that used to be required [SME: 7273]
|
||||
|
||||
* Thu Jan 31 2013 Shad L. Lords <slords@mail.com> 2.4.0-1.sme
|
||||
- Roll new stream for sme9
|
||||
|
||||
* Sun May 17 2009 Jonathan Martens <smeserver-contribs@snetram.nl> 2.2.0-2.sme
|
||||
- Fix another instance of ups model for new version of nut [SME: 4750]
|
||||
|
||||
* Tue Oct 7 2008 Shad L. Lords <slords@mail.com> 2.2.0-1.sme
|
||||
- Roll new stream to separate sme7/sme8 trees [SME: 4633]
|
||||
|
||||
* Tue Jan 08 2008 Stephen Noble <support@dungog.net> 1.2.0-17
|
||||
- Start rc7.d/S38nut up from S15 [SME: 3592]
|
||||
|
||||
* Fri Nov 30 2007 Gavin Weight <gweight@gmail.com> 1.2.0-16
|
||||
- Fix use of uninitialized value in nutModel migrate. [SME: 3597]
|
||||
|
||||
* Sun Oct 7 2007 Shad L. Lords <slords@mail.com> 1.2.0-15
|
||||
- Fix ups model for new version of nut [SME: 3457]
|
||||
|
||||
* Sun Jun 3 2007 Stephen Noble <support@dungog.net> 1.2.0-14
|
||||
- Fix mfr & mdl options in ups.conf [SME: 2791]
|
||||
|
||||
* Fri Jun 1 2007 Stephen Noble <support@dungog.net> 1.2.0-13
|
||||
- Add mfr & mdl options to ups.conf [SME: 2791]
|
||||
|
||||
* Fri Jun 1 2007 Stephen Noble <support@dungog.net> 1.2.0-12
|
||||
- Only use Type if model=genericups & type is defined [SME: 2748]
|
||||
|
||||
* Sun Apr 29 2007 Shad L. Lords <slords@mail.com>
|
||||
- Clean up spec so package can be built by koji/plague
|
||||
|
||||
* Tue Apr 10 2007 Stephen Noble <support@dungog.net> 1.2.0-10
|
||||
- Only use Type if model=genericups [SME: 2748]
|
||||
|
||||
* Fri Apr 06 2007 Shad L. Lords <slords@mail.com> 1.2.0-9
|
||||
- Fix perms on config files [SME: 2712]
|
||||
|
||||
* Fri Jan 19 2007 Shad L. Lords <slords@mail.com> 1.2.0-8
|
||||
- Don't expand upsd.conf in post-{install,upgrade}
|
||||
|
||||
* Thu Jan 18 2007 Shad L. Lords <slords@mail.com> 1.2.0-7
|
||||
- Fix password generation and simplify [SME: 2323]
|
||||
|
||||
* Sat Jan 13 2007 Shad L. Lords <slords@mail.com> 1.2.0-6
|
||||
- Add upstype option to ups.conf [SME: 2286]
|
||||
|
||||
* Thu Jan 04 2007 Shad L. Lords <slords@mail.com> 1.2.0-5
|
||||
- Actually call the notify script on ups events. [SME: 1722]
|
||||
- Allow nut to be a client to another master server. [SME: 2231]
|
||||
|
||||
* Thu Dec 21 2006 Shad L. Lords <slords@mail.com> 1.2.0-4
|
||||
- Make password secure for ups users
|
||||
- Allow local network to monitor ups as slaves
|
||||
- Make localhost master for ups
|
||||
- Make startup/shutdown scripts use upsdrvctl so poweroff works
|
||||
|
||||
* Thu Dec 07 2006 Shad L. Lords <slords@mail.com>
|
||||
- Update to new release naming. No functional changes.
|
||||
- Make Packager generic
|
||||
|
||||
* Sun May 28 2006 Charlie Brady <charlie_brady@mitel.com> 1.2.0-02
|
||||
- Fix perms on upsd.conf [SME: 1473]
|
||||
|
||||
* Wed Mar 15 2006 Charlie Brady <charlie_brady@mitel.com> 1.2.0-01
|
||||
- Roll stable stream version. [SME: 1016]
|
||||
|
||||
* Thu Feb 2 2006 Gordon Rowell <gordonr@gormand.com.au> 1.1.0-10
|
||||
- Added db default to match last change [SME: 26]
|
||||
|
||||
* Thu Feb 2 2006 Charlie Brady <charlie_brady@mitel.com> 1.1.0-09
|
||||
- Change default model from hidups to newhidups. [SME: 26]
|
||||
|
||||
* Wed Feb 01 2006 Charlie Brady <charlie_brady@mitel.com> 1.1.0-08
|
||||
- Ensure that device node has correct ownership. [SME: 619]
|
||||
|
||||
* Wed Nov 30 2005 Gordon Rowell <gordonr@gormand.com.au> 1.1.0-07
|
||||
- Bump release number only
|
||||
|
||||
* Tue Aug 16 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [1.1.0-06]
|
||||
- Match permissions on /etc/sysconfig/ups to those of the nut RPM.
|
||||
|
||||
* Mon Jul 25 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [1.1.0-05]
|
||||
- Remove unused /etc/usb/usb.usermap template fragment.
|
||||
- Add nut db entries to default configuration (Shad).
|
||||
- Add missing templates.metadata files for all templated
|
||||
files. [MN00064130]
|
||||
|
||||
* Tue Jul 12 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [1.1.0-04]
|
||||
- Use generic_template_expand action in place of nutUPS-conf.
|
||||
[MN00064130]
|
||||
|
||||
* Tue Jul 12 2005 Charlie Brady <charlieb@e-smith.com>
|
||||
- [1.1.0-03]
|
||||
- Port to version 2.0 of nut (contributed by Shad Lords).
|
||||
- Change nutups user to nut to confirm with new package
|
||||
- Upgrade templates to support new 2.0 format [SF: 1226389]
|
||||
|
||||
* Thu Aug 21 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [1.1.0-02]
|
||||
- Replace nutUPS-conf-startup action with default db fragments.
|
||||
[charlieb 9553]
|
||||
|
||||
* Thu Aug 21 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [1.1.0-01]
|
||||
- Changing version to development stream number - 1.1.0
|
||||
|
||||
* Thu Jun 26 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [1.0.0-01]
|
||||
- Creating stable version stream - 1.0.0
|
||||
|
||||
* Wed Jun 4 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.0.3-06]
|
||||
- Create 'nutups' user via create-system-user. [charlieb 6033]
|
||||
|
||||
* Fri May 9 2003 Gordon Rowell <gordonr@e-smith.com>
|
||||
- [0.0.3-05]
|
||||
- Removed depedency on e-smith-email [gordonr 8405]
|
||||
|
||||
* Fri Apr 25 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.0.3-04]
|
||||
- Change group and permissions of various configuration files, so that
|
||||
files can be reloaded by programs running non-root. This is a merge
|
||||
of Shad Lord's contributed code and my changes to use group read
|
||||
permission. [charlieb 8405]
|
||||
|
||||
* Fri Apr 25 2003 Tony Clayton <apc@e-smith.com>
|
||||
- [0.0.3-03]
|
||||
- Don't expand rc.modules template from nutUPS-conf [tonyc 2753]
|
||||
|
||||
* Fri Apr 25 2003 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.0.3-02]
|
||||
- Change group of nutUPS.notify script to nutups. [charlieb 8530]
|
||||
|
||||
* Wed Apr 16 2003 Tony Clayton <apc@e-smith.com>
|
||||
- [0.0.3-01]
|
||||
- Remove /etc/rc.modules altogether [tonyc 6556]
|
||||
|
||||
* Tue Mar 18 2003 Lijie Deng <lijied@e-smith.com>
|
||||
- [0.0.2-12]
|
||||
- Delete ./etc/rc.modules/template-begin,
|
||||
and modified %build [lijied 3295]
|
||||
|
||||
* Thu Jan 16 2003 Tony Clayton <apc@e-smith.com>
|
||||
- [0.0.2-11]
|
||||
- fix rc.modules usb drivers again [tonyc 2753]
|
||||
|
||||
* Mon Jan 13 2003 Tony Clayton <apc@e-smith.com>
|
||||
- [0.0.2-10]
|
||||
- fix rc.modules usb drivers to load conditionally [tonyc 2753]
|
||||
|
||||
* Mon Jan 13 2003 Tony Clayton <apc@e-smith.com>
|
||||
- [0.0.2-09]
|
||||
- send stdout/stderr to /dev/null when loading usb modules [tonyc 2753]
|
||||
|
||||
* Mon Jan 13 2003 Tony Clayton <apc@e-smith.com>
|
||||
- [0.0.2-08]
|
||||
- really adding usb* modules in rc.modules [tonyc 2753]
|
||||
|
||||
* Mon Jan 13 2003 Tony Clayton <apc@e-smith.com>
|
||||
- [0.0.2-07]
|
||||
- load usb* modules in rc.modules for hidups support
|
||||
- add header to template-begin [tonyc 2753]
|
||||
|
||||
* Fri Jan 10 2003 Tony Clayton <apc@e-smith.com>
|
||||
- [0.0.2-06]
|
||||
- fix NOTIFYFLAG entries in upsmon.conf [tonyc 2753]
|
||||
- turn off nut service by default [tonyc 2753]
|
||||
|
||||
* Thu Dec 5 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.0.2-05]
|
||||
- Move mknod of device node to %post script. It can't run in %pre, because
|
||||
the enclosing directory has not yet been pulled out of the RPM archive.
|
||||
|
||||
* Thu Dec 5 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.0.2-04]
|
||||
- Fix syntax errors in one of the upsmon.conf template fragments.
|
||||
- Add ups runtime state directory. Create hiddev device node with
|
||||
appropriate permissions inside that directory.
|
||||
|
||||
* Wed Nov 27 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.0.2-03]
|
||||
- Change configuration so that most UPS events are logged only to
|
||||
syslog, but SHUTDOWN is done using "signal-event". Response
|
||||
to UPS events can be tuned via config DB entries.
|
||||
|
||||
* Tue Nov 19 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.0.2-02]
|
||||
- Add /etc/rc.d/init.d/nut symlink so that service starts up.
|
||||
- Fix up a few broken templates.
|
||||
|
||||
* Mon Nov 18 2002 Charlie Brady <charlieb@e-smith.com>
|
||||
- [0.0.2-01]
|
||||
- Initial
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
rm -rf root/etc/rc.d/init.d/nut root/etc/rc.d/rc7.d/S38nut
|
||||
mkdir -p root/usr/lib/systemd/system/nut-monitor.service.d root/usr/lib/systemd/system/nut-server.service.d
|
||||
|
||||
|
||||
%build
|
||||
perl createlinks
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
|
||||
rm -f %{name}-%{version}-%{release}-filelist
|
||||
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||
| sed -e '/nutUPS.notify/s/root,root/root,nut/' \
|
||||
> %{name}-%{version}-%{release}-filelist
|
||||
echo '%dir %attr(750,nut,nut) /var/lib/ups' \
|
||||
>> %{name}-%{version}-%{release}-filelist
|
||||
echo '%ghost %attr(640,nut,nut) /var/lib/ups/hiddev0' \
|
||||
>> %{name}-%{version}-%{release}-filelist
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/ups/
|
||||
touch $RPM_BUILD_ROOT/var/lib/ups/hiddev0
|
||||
|
||||
%pre
|
||||
/sbin/e-smith/create-system-user nut 57 'NUT UPS user' /var/lib/ups /bin/false
|
||||
|
||||
%post
|
||||
if [ \! -e /var/lib/ups/hiddev0 ]
|
||||
then
|
||||
mknod /var/lib/ups/hiddev0 c 180 96
|
||||
fi
|
||||
chown nut.nut /var/lib/ups/hiddev0
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files -f %{name}-%{version}-%{release}-filelist
|
||||
%defattr(-,root,root)
|
1
root/etc/e-smith/db/configuration/defaults/nut/AdminUser
Normal file
1
root/etc/e-smith/db/configuration/defaults/nut/AdminUser
Normal file
@ -0,0 +1 @@
|
||||
disabled
|
1
root/etc/e-smith/db/configuration/defaults/nut/Model
Normal file
1
root/etc/e-smith/db/configuration/defaults/nut/Model
Normal file
@ -0,0 +1 @@
|
||||
usbhid-ups
|
1
root/etc/e-smith/db/configuration/defaults/nut/access
Normal file
1
root/etc/e-smith/db/configuration/defaults/nut/access
Normal file
@ -0,0 +1 @@
|
||||
localhost
|
1
root/etc/e-smith/db/configuration/defaults/nut/status
Normal file
1
root/etc/e-smith/db/configuration/defaults/nut/status
Normal file
@ -0,0 +1 @@
|
||||
disabled
|
1
root/etc/e-smith/db/configuration/defaults/nut/type
Normal file
1
root/etc/e-smith/db/configuration/defaults/nut/type
Normal file
@ -0,0 +1 @@
|
||||
service
|
6
root/etc/e-smith/db/configuration/migrate/nutModel
Normal file
6
root/etc/e-smith/db/configuration/migrate/nutModel
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
my $nutmod = $DB->get_prop('nut', 'Model');
|
||||
return unless $nutmod;
|
||||
$DB->set_prop('nut', 'Model', 'usbhid-ups') if ($nutmod eq 'newhidups');
|
||||
}
|
||||
|
8
root/etc/e-smith/db/configuration/migrate/nutPass
Normal file
8
root/etc/e-smith/db/configuration/migrate/nutPass
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
use MIME::Base64 qw(encode_base64);
|
||||
|
||||
my $nutrec = $DB->get('nut') || $DB->new_record('nut', {type => 'service'});
|
||||
$nutrec->set_prop('MasterPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('MasterPass');
|
||||
$nutrec->set_prop('SlavePass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('SlavePass');
|
||||
$nutrec->set_prop('AdminPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('AdminPass');
|
||||
}
|
1
root/etc/e-smith/templates.metadata/etc/sysconfig/ups
Normal file
1
root/etc/e-smith/templates.metadata/etc/sysconfig/ups
Normal file
@ -0,0 +1 @@
|
||||
PERMS=0644
|
3
root/etc/e-smith/templates.metadata/etc/ups/ups.conf
Normal file
3
root/etc/e-smith/templates.metadata/etc/ups/ups.conf
Normal file
@ -0,0 +1,3 @@
|
||||
UID="root"
|
||||
GID="nut"
|
||||
PERMS=0640
|
3
root/etc/e-smith/templates.metadata/etc/ups/upsd.conf
Normal file
3
root/etc/e-smith/templates.metadata/etc/ups/upsd.conf
Normal file
@ -0,0 +1,3 @@
|
||||
UID="root"
|
||||
GID="nut"
|
||||
PERMS=0640
|
3
root/etc/e-smith/templates.metadata/etc/ups/upsd.users
Normal file
3
root/etc/e-smith/templates.metadata/etc/ups/upsd.users
Normal file
@ -0,0 +1,3 @@
|
||||
UID="root"
|
||||
GID="nut"
|
||||
PERMS=0640
|
3
root/etc/e-smith/templates.metadata/etc/ups/upsmon.conf
Normal file
3
root/etc/e-smith/templates.metadata/etc/ups/upsmon.conf
Normal file
@ -0,0 +1,3 @@
|
||||
UID="root"
|
||||
GID="nut"
|
||||
PERMS=0640
|
@ -0,0 +1,3 @@
|
||||
UID="root"
|
||||
GID="nut"
|
||||
PERMS=0640
|
3
root/etc/e-smith/templates/etc/hosts.allow/upsd
Normal file
3
root/etc/e-smith/templates/etc/hosts.allow/upsd
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
$DB->hosts_allow_spec('nut','nut');
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
return "# The upsd admin is not allowed" if ($nut{AdminUser} ne 'enabled');
|
||||
return "# The upsd admin has no password" if (($nut{AdminPass} || '') eq '');
|
||||
return "# The upsd admin is not allowed when nut access is set to public" if $nut{access} eq 'public';
|
||||
|
||||
my $upsd = $DB->hosts_allow_spec('nut','upsd');
|
||||
$upsd =~ s|upsd:|upsd: admin op |;
|
||||
|
||||
$OUT .= qq(#Allow the Admin User of upsd
|
||||
$upsd : ALLOW) if ($nut{status} eq 'enabled');
|
||||
}
|
3
root/etc/e-smith/templates/etc/services/30Nut
Normal file
3
root/etc/e-smith/templates/etc/services/30Nut
Normal file
@ -0,0 +1,3 @@
|
||||
#Nut Service
|
||||
nut 3493/tcp # Network UPS Tools
|
||||
nut 3493/udp # Network UPS Tools
|
1
root/etc/e-smith/templates/etc/sysconfig/ups/MODEL
Normal file
1
root/etc/e-smith/templates/etc/sysconfig/ups/MODEL
Normal file
@ -0,0 +1 @@
|
||||
MODEL=upsdrvctl
|
1
root/etc/e-smith/templates/etc/sysconfig/ups/SERVER
Normal file
1
root/etc/e-smith/templates/etc/sysconfig/ups/SERVER
Normal file
@ -0,0 +1 @@
|
||||
SERVER={ $nut{Master} || 'yes' }
|
@ -0,0 +1,16 @@
|
||||
# nut UPS specific subservices
|
||||
{
|
||||
$nutstatus = $nut{status} || 'disabled';
|
||||
$master = $nut{Master} || 'yes';
|
||||
|
||||
if ($nutstatus eq 'enabled') {
|
||||
$OUT .= "enable nut-server.service\n" if ($master eq 'yes');
|
||||
$OUT .= "disable nut-server.service\n" unless ($master eq 'yes');
|
||||
$OUT .= "enable nut-monitor.service\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$OUT .= "disable nut-server.service\n";
|
||||
$OUT .= "disable nut-monitor.service\n";
|
||||
}
|
||||
}
|
16
root/etc/e-smith/templates/etc/ups/ups.conf/UPS
Normal file
16
root/etc/e-smith/templates/etc/ups/ups.conf/UPS
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
my $model = $nut{Model} || "usbhid-ups";
|
||||
my $device = $nut{Device} || "/var/lib/ups/hiddev0";
|
||||
my $type = $nut{Type};
|
||||
my $mfr = $nut{mfr};
|
||||
my $mdl = $nut{mdl};
|
||||
$OUT .= "[UPS]\n";
|
||||
$OUT .= "\tdriver = $model\n";
|
||||
if ($model eq 'genericups')
|
||||
{
|
||||
$OUT .= "\tupstype = $type\n" if defined $type;
|
||||
$OUT .= "\tmfr = $mfr\n" if defined $mfr;
|
||||
$OUT .= "\tmodel = $mdl\n" if defined $mdl;
|
||||
}
|
||||
$OUT .= "\tport = $device\n";
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
my $access = $nut{access} || 'localhost';
|
||||
|
||||
$OUT .= "LISTEN 127.0.0.1";
|
||||
$OUT .= "\nLISTEN $LocalIP" if ($access eq 'private');
|
||||
}
|
8
root/etc/e-smith/templates/etc/ups/upsd.users/monitor
Normal file
8
root/etc/e-smith/templates/etc/ups/upsd.users/monitor
Normal file
@ -0,0 +1,8 @@
|
||||
[upsmaster]
|
||||
password = { $nut{MasterPass} }
|
||||
upsmon master
|
||||
|
||||
[upsslave]
|
||||
password = { $nut{SlavePass} }
|
||||
upsmon slave
|
||||
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
# create admin user for upsd to allow setting of
|
||||
# UPS parameters via upsrw
|
||||
|
||||
$OUT .= "";
|
||||
return unless (($nut{AdminUser} || 'disabled') eq 'enabled');
|
||||
return unless (($nut{AdminPass} || '') ne '');
|
||||
|
||||
$OUT .= "\n";
|
||||
$OUT .= " [admin]\n";
|
||||
$OUT .= " password = $nut{AdminPass}\n";
|
||||
$OUT .= " actions = set\n";
|
||||
$OUT .= " instcmds = all\n";
|
||||
}
|
1
root/etc/e-smith/templates/etc/ups/upsmon.conf/DEADTIME
Normal file
1
root/etc/e-smith/templates/etc/ups/upsmon.conf/DEADTIME
Normal file
@ -0,0 +1 @@
|
||||
DEADTIME 15
|
@ -0,0 +1 @@
|
||||
FINALDELAY 5
|
1
root/etc/e-smith/templates/etc/ups/upsmon.conf/HOSTSYNC
Normal file
1
root/etc/e-smith/templates/etc/ups/upsmon.conf/HOSTSYNC
Normal file
@ -0,0 +1 @@
|
||||
HOSTSYNC 15
|
@ -0,0 +1 @@
|
||||
MINSUPPLIES 1
|
7
root/etc/e-smith/templates/etc/ups/upsmon.conf/MONITOR
Normal file
7
root/etc/e-smith/templates/etc/ups/upsmon.conf/MONITOR
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
if ( ($nut{Master} || 'yes') ne 'no' ) {
|
||||
$OUT = "MONITOR UPS\@localhost 1 upsmaster $nut{MasterPass} master";
|
||||
} else {
|
||||
$OUT = "MONITOR $nut{SlaveUPS} 1 upsslave $nut{SlavePass} slave";
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
NOCOMMWARNTIME 300
|
1
root/etc/e-smith/templates/etc/ups/upsmon.conf/NOTIFYCMD
Normal file
1
root/etc/e-smith/templates/etc/ups/upsmon.conf/NOTIFYCMD
Normal file
@ -0,0 +1 @@
|
||||
NOTIFYCMD /sbin/e-smith/nutUPS.notify
|
@ -0,0 +1,9 @@
|
||||
NOTIFYFLAG COMMBAD SYSLOG+WALL+EXEC
|
||||
NOTIFYFLAG COMMOK SYSLOG+WALL+EXEC
|
||||
NOTIFYFLAG FSD SYSLOG+WALL+EXEC
|
||||
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
|
||||
NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC
|
||||
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
|
||||
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
|
||||
NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
|
||||
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
|
1
root/etc/e-smith/templates/etc/ups/upsmon.conf/POLLFREQ
Normal file
1
root/etc/e-smith/templates/etc/ups/upsmon.conf/POLLFREQ
Normal file
@ -0,0 +1 @@
|
||||
POLLFREQ 5
|
@ -0,0 +1 @@
|
||||
POLLFREQALERT 5
|
@ -0,0 +1 @@
|
||||
POWERDOWNFLAG /etc/killpower
|
@ -0,0 +1 @@
|
||||
RBWARNTIME 43200
|
@ -0,0 +1 @@
|
||||
SHUTDOWNCMD "/sbin/e-smith/signal-event halt"
|
@ -0,0 +1 @@
|
||||
# For more information see "man upssched.conf"
|
@ -0,0 +1,3 @@
|
||||
[Unit]
|
||||
PartOf=nut.service
|
||||
After=nut.service network-online.target
|
@ -0,0 +1,4 @@
|
||||
[Service]
|
||||
ExecStartPre=
|
||||
ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-run.conf
|
||||
ExecStartPre=/sbin/e-smith/service-status nut
|
@ -0,0 +1,2 @@
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
@ -0,0 +1,4 @@
|
||||
[Unit]
|
||||
PartOf=nut.service
|
||||
After=nut.service network-online.target
|
||||
|
@ -0,0 +1,2 @@
|
||||
[Service]
|
||||
ExecStartPre=/sbin/e-smith/service-status nut
|
@ -0,0 +1,2 @@
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
0
root/etc/rc.d/init.d/.gitignore
vendored
Normal file
0
root/etc/rc.d/init.d/.gitignore
vendored
Normal file
0
root/etc/rc.d/rc7.d/.gitignore
vendored
Normal file
0
root/etc/rc.d/rc7.d/.gitignore
vendored
Normal file
6
root/sbin/e-smith/nutUPS.notify
Normal file
6
root/sbin/e-smith/nutUPS.notify
Normal file
@ -0,0 +1,6 @@
|
||||
#! /bin/sh
|
||||
# UPS notify script.
|
||||
|
||||
/bin/mail -s "$UPSNAME: $NOTIFYTYPE" admin <<END
|
||||
$*
|
||||
END
|
@ -0,0 +1,14 @@
|
||||
#------------------------------------------------------------
|
||||
# !!DO NOT MODIFY THIS FILE!!
|
||||
#
|
||||
# Manual changes will be lost when this file is regenerated.
|
||||
#
|
||||
# Please read the developer's guide, which is available
|
||||
# at http://www.contribs.org/development/
|
||||
#
|
||||
# Copyright (C) 1999-2006 Mitel Networks Corporation
|
||||
#------------------------------------------------------------
|
||||
|
||||
[Service]
|
||||
ExecStartPre=
|
||||
ExecStartPre=-/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/nut-run.conf
|
0
root/usr/lib/systemd/system/nut-monitor.service.d/.gitignore
vendored
Normal file
0
root/usr/lib/systemd/system/nut-monitor.service.d/.gitignore
vendored
Normal file
0
root/usr/lib/systemd/system/nut-server.service.d/.gitignore
vendored
Normal file
0
root/usr/lib/systemd/system/nut-server.service.d/.gitignore
vendored
Normal file
23
root/usr/lib/systemd/system/nut.service
Normal file
23
root/usr/lib/systemd/system/nut.service
Normal file
@ -0,0 +1,23 @@
|
||||
[Unit]
|
||||
Description=Network UPS Tools - Parent service for Koozali SME Server
|
||||
After=local-fs.target network.target network-online.target
|
||||
Before=nut-server.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/sbin/e-smith/service-status nut
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /etc/sysconfig/ups
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /etc/ups/ups.conf
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /etc/ups/upsd.conf
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /etc/ups/upsd.users
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /etc/ups/upsmon.conf
|
||||
ExecStartPre=-/sbin/e-smith/expand-template /etc/ups/upssched.conf
|
||||
|
||||
# The dummy program will exit
|
||||
Type=oneshot
|
||||
# Execute a dummy program
|
||||
ExecStart=/bin/true
|
||||
# This service shall be considered active after start
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target sme-server.target
|
Loading…
Reference in New Issue
Block a user