[Nut-upsuser] Fopen upsmon.pid - no such file or directory - Nut 2.8.0 built from source
Dan Grostick
danpower2023 at outlook.com
Sat Jun 10 02:28:14 BST 2023
I've built NUT 2.8.0 from source. When the nut-monitor runs: fopen upsmon.pid fails. I'm running as root, upsmon has root:root permissions as well as the other daemons and .conf files. I've tried configuring with and without --prefixpath --prefixaltpath.
Is there something I am missing?
Please see attached.
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20230610/06578ece/attachment-0001.htm>
-------------- next part --------------
===============================================================
Previous complete boot through shutdown
Jun 08 22:08:48 raspberrypi nut-server[1208]: fopen /var/state/ups/upsd.pid: No such file or directory
Jun 08 22:08:48 raspberrypi nut-server[1208]: Could not find PID file '/var/state/ups/upsd.pid' to see if previous upsd instance is already running!
Jun 08 22:08:48 raspberrypi nut-server[1208]: /etc/nut/upsd.conf is world readable
Jun 08 22:08:48 raspberrypi upsd[1208]: /etc/nut/upsd.conf is world readable
Jun 08 22:08:48 raspberrypi upsd[1208]: listening on 192.168.123.48 port 3493
Jun 08 22:08:48 raspberrypi upsd[1208]: Connected to UPS [heartbeat]: dummy-ups-heartbeat
Jun 08 22:08:48 raspberrypi upsd[1208]: Connected to UPS [ups]: usbhid-ups-ups
Jun 08 22:08:48 raspberrypi upsd[1208]: Found 2 UPS defined in ups.conf
Jun 08 22:08:48 raspberrypi nut-server[1208]: /etc/nut/upsd.users is world readable
Jun 08 22:08:48 raspberrypi upsd[1208]: /etc/nut/upsd.users is world readable
Jun 08 22:08:48 raspberrypi upsd[1208]: Running as foreground process, not saving a PID file
Jun 08 22:08:50 raspberrypi nut-monitor[1213]: fopen /run/upsmon.pid: No such file or directory
Jun 08 22:08:50 raspberrypi nut-monitor[1213]: Could not find PID file to see if previous upsmon instance is already running!
Jun 08 22:08:50 raspberrypi nut-monitor[1213]: Convert it and add a username to upsd.users - see the documentation
Jun 08 22:08:50 raspberrypi nut-monitor[1213]: Network UPS Tools upsmon 2.8.0.1
Jun 08 22:08:50 raspberrypi nut-monitor[1215]: fopen /run/upsmon.pid: No such file or directory
Jun 08 22:08:50 raspberrypi nut-monitor[1215]: Could not find PID file to see if previous upsmon instance is already running!
Jun 08 22:08:50 raspberrypi nut-monitor[1215]: Convert it and add a username to upsd.users - see the documentation
=====================================================================================================================
./configure \
--prefix=/usr \
--includedir=/usr/include \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc/nut \
--localstatedir=/var/run/nut \
--libexecdir=/usr/lib/nut \
--srcdir=. \
--disable-silent-rules \
--libdir=/usr/lib/`gcc -print-multiarch` \
--with-cgipath=/usr/lib/cgi-bin/nut \
--with-htmlpath=/usr/share/nut/www \
--with-pidpath=/var/run/nut \
--with-altpidpath=/var/run/nut-alt \
--datadir=/usr/share/nut \
--with-udev-dir=/lib/udev \
--with-systemdsystemunitdir=/lib/systemd/system \
--with-user=root \
--with-group=root \
--with-usb \
--with-cgi \
--with-drivers=usbhid-ups,dummy-ups \
--with-doc=man \
--with-serial=no \
--with-pkgconfig-dir=/usr/lib/'gcc -print-multiarch'/pkgconfig
########### Operating system ###########
Kernel release 6.1.21-v7+ GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_CODENAME=bullseye
Network UPS Tools upsd 2.8.0.1
Bash version 5.1.4(1)-release
User root
updated-nut-report version: 2020-08-07
########### USB attached UPS units ###########
Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 004: ID 0b38:0010 Gear Head 107-Key Keyboard
########### /etc/nut//nut.conf ###########
MODE=standalone
########### /etc/nut//ups.conf ###########
maxretry = 2
[ups]
driver=usbhid-ups
desc="APS BR1600G UPS"
port=auto
offdelay = 20
[heartbeat]
driver=dummy-ups
port=heartbeat.conf
mode=dummy-once
desc="Heart beat verification of NUT"
########### /etc/nut//upsd.conf ###########
STATEPATH /var/state/ups
LISTEN 192.168.123.48 3493
########### /etc/nut//upsd.users ###########
[upsmonitor]
password = ****m****
actions = SET
instcmds = ALL
upsmon master
[admin]
password = ****m****
actions = SET
instcmds = ALL
upsmon master
[root]
password = ****m****
actions = SET
instcmds = ALL
upsmon master
[upsmon]
password = ****m****
actions = SET
instcmds = ALL
upsmon master
[dan]
password = ****m****
actions = SET
instcmds = ALL
upsmon master
[nut]
password = ****m****
actions = SET
instcmds = ALL
upsmon master
########### /etc/nut//upsmon.conf ###########
RUN_AS_USER root
MONITOR ups at localhost 1 upsmonitor ****m**** primery
MONITOR heartbeat at localhost 0 heartbeat ****m****
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +2"
NOTIFYCMD /etc/nut/upssched-cmd
POLLFREQ 10
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 30
POWERDOWNFLAG /etc/killpower
NOTIFYMSG ONLINE "online"
NOTIFYMSG ONBATT "onbatt"
NOTIFYMSG LOWBATT "lowbatt"
NOTIFYMSG FSD "fsd"
NOTIFYMSG COMMOK "commok"
NOTIFYMSG COMMBAD "commbad"
NOTIFYMSG SHUTDOWN "shutdown"
NOTIFYMSG REPLBATT "replacebatt"
NOTIFYMSG NOCOMM "nocomm"
NOTIFYMSG NOPARENT "noparent"
NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC
NOTIFYFLAG FSD SYSLOG+WALL+EXEC
NOTIFYFLAG COMMOK SYSLOG+WALL+EXEC
NOTIFYFLAG COMMBAD SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMM SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC
RBWARNTIME 43200
NOCOMMWARNTIME 60
FINALDELAY 15
########### /etc/nut//upssched.conf ###########
CMDSCRIPT /etc/nut/upssched-cmd
PIPEFN /var/state/ups/upssched/upssched.pipe
LOCKFN /var/state/ups/upssched/upssched.lock
AT ONBATT ups at localhost START-TIMER onbatt-timer 10
AT LOWBATT ups at localhost EXECUTE lobatt
AT COMMBAD ups at localhost EXECUTE commbad
AT COMMOK ups at localhost CANCEL-TIMER nocomm-timer
AT COMMOK ups at localhost EXECUTE commok
AT NOCOMM ups at localhost START-TIME nocomm-timer 30
AT SHUTDOWN ups at localhost EXECUTE powerdown
AT FSD ups at localhost EXECUTE fsd
AT NOPARENT ups at localhost EXECUTE noparent
AT REPLBATT ups at localhost EXECUTE replacebatt
AT ONLINE ups at localhost CANCEL-TIMER onbatt-timer
AT ONLINE ups at localhost EXECUTE online
AT ONLINE ups at localhost CANCEL-TIMER heartbeat-failure-timer
AT ONBATT heartbeat at localhost CANCEL-TIMER heartbeat-failure-timer
AT ONBATT heartbeat at localhost START-TIMER heartbeat-failure-timer 660
########### /etc/nut/upssched-cmd ###########
logger -t upsched-cmd: "upsched-cmd running"
UPS="ups at localhost"
STATUS=$( upsc $UPS ups.status)
CHARGE=$( upsc $UPS battery.charge)
CHMSG="[$STATUS] : $CHARGE%"
case $1 in
online)
logger -t upssched-cmd: "online"
MSG1="Subject: UPS online"
MSG2="\nCurrent status: $CHMSG $1"
cat /etc/nut/online.txt >/tmp/message
echo -e "$MSG2" >> /tmp/message
msmtp -t </tmp/message
;;
onbatt)
logger -t upssched-cmd: "onbatt"
;;
lowbatt)
logger -t upssched-cmd: "lowbatt"
MSG1="\nUPS low batt - shutting down\n"
MSG2="Current status: $CHMSG $1"
cat /etc/nut/lowbatt.txt >/tmp/message
echo -e "$MSG1 $MSG2" >>/tmp/message
msmtp -t </tmp/message
/usr/sbin/upsmon -c fsd
;;
commok)
logger -t upssched-cmd: "commok"
msmtp -t dan.grostick at outlook.com </etc/nut/commok.txt
;;
commbad)
logger -t upssched-cmd: "commbad"
msmtp -t dan.grostick at outlook.com </etc/nut/commbad.txt
;;
shutdown)
logger -t upssched-cmd: "shutdown"
msmtp -t dan.grostick at outlook.com </etc/nut/shutdown.txt
;;
replacebatt)
logger -t upssched-cmd: "replacebatt"
msmtp -t dan.grostick at outlook.com </etc/nut/replacebatt.txt
;;
nocomm)
logger -t upssched-cmd: "nocomm"
;;
noparent)
logger -t upssched-cmd: "noparent"
msmtp -t dan.grostick at outlook.com </etc/nut/noparent.txt
;;
fsd)
logger -t upssched-cmd: "fsd"
msmtp -t dan.grostick at outlook.com </etc/nut/fsd.txt
;;
heartbeat-failure-timer)
logger -t upssched-cmd: "heart beat fails"
MSG1="\nNUT hearbeat fails"
MSG2="\nCurrent status: $CHMSG $1"
MSG3="\n$(ps -elf |grep -E 'ups[dms] |nut')"
cat /etc/nut/heartbeatfails.txt >/tmp/message
echo -e "$MSG1 $MSG2 $MSG3" >>/tmp/message
msmtp -t </tmp/message
;;
onbatt-timer)
logger -t upssched-cmd: "onbatt-timer-expired"
MSG1="\nUPS is on battery"
MSG2="\nCurrent status: $CHMSG $1"
cat /etc/nut/onbatt.txt >/tmp/message
echo -e "$MSG1 $MSG2" >>/tmp/message
msmtp -t </tmp/message
;;
nocomm-timer)
logger -t upssched-cmd: "nocomm-timer-expired"
msmtp -t dan.grostick at outlook.com </etc/nut/nocomm.txt
;;
*)
logger -t upssched-cmd: "unknown command" \"$1\"
msmtp -t dan.grostick at outlook.com </etc/nut/unknowncommand.txt
;;
esac
exit 0
########### /etc/hosts.allow ###########
########### ps -eLf ###########
########### Ownership and permissions of executables ###########
-rwxr-xr-x 1 root root 333348 Jun 9 12:46 /usr/sbin//upsd*
-rwxr-xr-x 1 root root 163600 Jun 9 12:46 /usr/sbin//upsdrvctl*
-rwxr-xr-x 1 root root 6466 Jun 9 12:46 /usr/sbin//upsdrvsvcctl*
-rwxr-xr-x 1 root root 182636 Jun 9 12:46 /usr/sbin//upsmon*
-rwxr-xr-x 1 root root 133088 Jun 9 12:46 /usr/sbin//upssched*
########### Ownership and permissions of configuration files ###########
-rw-r--r-- 1 root root 15269 Jun 7 15:55 /etc/nut//\
-rw-r--r-- 1 root root 89 Jun 7 12:52 /etc/nut//commbad.txt
-rw-r--r-- 1 root root 83 Jun 7 12:52 /etc/nut//commok.txt
-rw-r--r-- 1 root root 79 Jun 7 12:52 /etc/nut//fsd.txt
-rw-r--r-- 1 root root 50 Jun 7 12:52 /etc/nut//heartbeat.conf
-rw-r--r-- 1 root root 64 Jun 9 15:20 /etc/nut//heartbeatfails.txt
-rwxr-xr-x 1 root root 1158 Jun 7 12:52 /etc/nut//hosts.conf*
-rw-r--r-- 1 root root 58 Jun 9 15:12 /etc/nut//lowbatt.txt
-rw-r--r-- 1 root root 85 Jun 7 12:52 /etc/nut//nocomm.txt
-rw-r--r-- 1 root root 79 Jun 7 12:52 /etc/nut//noparent.txt
-rw-r--r-- 1 root root 1544 Jun 7 14:00 /etc/nut//nut.conf
-rw-r--r-- 1 root root 64 Jun 9 15:19 /etc/nut//onbatt.txt
-rw-r--r-- 1 root root 53 Jun 9 14:45 /etc/nut//online.txt
-rw-r--r-- 1 root root 105 Jun 7 12:52 /etc/nut//replacebatt.txt
-rw-r--r-- 1 root root 93 Jun 7 12:52 /etc/nut//shutdown.txt
-rw-r--r-- 1 root root 147 Jun 7 15:11 /etc/nut//start
-rw-r--r-- 1 root root 328 Jun 7 12:52 /etc/nut//stop
-rw-r--r-- 1 root root 71 Jun 7 12:52 /etc/nut//unknowncommand.txt
-rwxr-xr-x 1 root root 5718 Jun 9 15:35 /etc/nut//ups.conf*
-rwxr-xr-x 1 root root 4625 Jun 8 22:10 /etc/nut//upsd.conf*
-rwxr-xr-x 1 root root 4629 Jun 8 15:39 /etc/nut//upsd.conf.bak*
-rwxr-xr-x 1 root root 2619 Jun 7 14:16 /etc/nut//upsd.users*
-rwxr-xr-x 1 root root 15270 Jun 7 15:58 /etc/nut//upsmon.conf*
-rwxr-xr-x 1 root root 2252 Jun 9 15:25 /etc/nut//upssched-cmd*
-rwxr-xr-x 1 root root 2155 Jun 7 15:24 /etc/nut//upssched-cmd.bak*
-rwxr-xr-x 1 root root 4662 Jun 8 20:48 /etc/nut//upssched.conf*
-rw-r--r-- 1 root root 4593 Jun 7 12:52 /etc/nut//upsshed.conf.bak
########### Custom NOTIFYCMD scheduler /etc/nut/upssched-cmd ###########
logger -t upsched-cmd: "upsched-cmd running"
UPS="ups at localhost"
STATUS=$( upsc $UPS ups.status)
CHARGE=$( upsc $UPS battery.charge)
CHMSG="[$STATUS] : $CHARGE%"
case $1 in
online)
logger -t upssched-cmd: "online"
MSG1="Subject: UPS online"
MSG2="\nCurrent status: $CHMSG $1"
cat /etc/nut/online.txt >/tmp/message
echo -e "$MSG2" >> /tmp/message
msmtp -t </tmp/message
;;
onbatt)
logger -t upssched-cmd: "onbatt"
;;
lowbatt)
logger -t upssched-cmd: "lowbatt"
MSG1="\nUPS low batt - shutting down\n"
MSG2="Current status: $CHMSG $1"
cat /etc/nut/lowbatt.txt >/tmp/message
echo -e "$MSG1 $MSG2" >>/tmp/message
msmtp -t </tmp/message
/usr/sbin/upsmon -c fsd
;;
commok)
logger -t upssched-cmd: "commok"
msmtp -t dan.grostick at outlook.com </etc/nut/commok.txt
;;
commbad)
logger -t upssched-cmd: "commbad"
msmtp -t dan.grostick at outlook.com </etc/nut/commbad.txt
;;
shutdown)
logger -t upssched-cmd: "shutdown"
msmtp -t dan.grostick at outlook.com </etc/nut/shutdown.txt
;;
replacebatt)
logger -t upssched-cmd: "replacebatt"
msmtp -t dan.grostick at outlook.com </etc/nut/replacebatt.txt
;;
nocomm)
logger -t upssched-cmd: "nocomm"
;;
noparent)
logger -t upssched-cmd: "noparent"
msmtp -t dan.grostick at outlook.com </etc/nut/noparent.txt
;;
fsd)
logger -t upssched-cmd: "fsd"
msmtp -t dan.grostick at outlook.com </etc/nut/fsd.txt
;;
heartbeat-failure-timer)
logger -t upssched-cmd: "heart beat fails"
MSG1="\nNUT hearbeat fails"
MSG2="\nCurrent status: $CHMSG $1"
MSG3="\n$(ps -elf |grep -E 'ups[dms] |nut')"
cat /etc/nut/heartbeatfails.txt >/tmp/message
echo -e "$MSG1 $MSG2 $MSG3" >>/tmp/message
msmtp -t </tmp/message
;;
onbatt-timer)
logger -t upssched-cmd: "onbatt-timer-expired"
MSG1="\nUPS is on battery"
MSG2="\nCurrent status: $CHMSG $1"
cat /etc/nut/onbatt.txt >/tmp/message
echo -e "$MSG1 $MSG2" >>/tmp/message
msmtp -t </tmp/message
;;
nocomm-timer)
logger -t upssched-cmd: "nocomm-timer-expired"
msmtp -t dan.grostick at outlook.com </etc/nut/nocomm.txt
;;
*)
logger -t upssched-cmd: "unknown command" \"$1\"
msmtp -t dan.grostick at outlook.com </etc/nut/unknowncommand.txt
;;
esac
exit 0
########### Operating system ###########
Kernel release 6.1.21-v7+ GNU/Linux
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_CODENAME=bullseye
Network UPS Tools upsd 2.8.0.1
Bash version 5.1.4(1)-release
User root
updated-nut-report version: 2020-08-07
########### USB attached UPS units ###########
Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 004: ID 0b38:0010 Gear Head 107-Key Keyboard
########### /etc/nut//nut.conf ###########
MODE=standalone
########### /etc/nut//ups.conf ###########
maxretry = 2
[ups]
ââââââdriver=usbhid-ups
ââââââdesc="APS BR1600G UPS"
ââââââport=auto
ââââââoffdelay = 20
[heartbeat]
ââââââdriver=dummy-ups
ââââââport=heartbeat.conf
ââââââmode=dummy-once
ââââââdesc="Heart beat verification of NUT"
########### /etc/nut//upsd.conf ###########
STATEPATH /var/state/ups
LISTEN 192.168.123.48 3493
########### /etc/nut//upsd.users ###########
ââââââ[upsmonitor]
ââââââââââââpassword = ****m****
ââââââââââââactions = SET
ââââââââââââinstcmds = ALL
ââââââââââââupsmon master
ââââââ[admin]
ââââââââââââpassword = ****m****
ââââââââââââactions = SET
ââââââââââââinstcmds = ALL
ââââââââââââupsmon master
ââââââ[root]
ââââââââââââpassword = ****m****
ââââââââââââactions = SET
ââââââââââââinstcmds = ALL
ââââââââââââupsmon master
ââââââ[upsmon]
ââââââââââââpassword = ****m****
ââââââââââââactions = SET
ââââââââââââinstcmds = ALL
ââââââââââââupsmon master
ââââââ[dan]
ââââââââââââpassword = ****m****
ââââââââââââactions = SET
ââââââââââââinstcmds = ALL
ââââââââââââupsmon master
ââââââ[nut]
ââââââââââââpassword = ****m****
ââââââââââââactions = SET
ââââââââââââinstcmds = ALL
ââââââââââââupsmon master
########### /etc/nut//upsmon.conf ###########
RUN_AS_USER root
MONITOR ups at localhost 1 upsmonitor ****m**** primery
MONITOR heartbeat at localhost 0 heartbeat ****m****
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +2"
NOTIFYCMD /etc/nut/upssched-cmd
POLLFREQ 10
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 30
POWERDOWNFLAG /etc/killpower
NOTIFYMSG ONLINEââ"online"
NOTIFYMSG ONBATTââ"onbatt"
NOTIFYMSG LOWBATTâ"lowbatt"
NOTIFYMSG FSDâââââââââââ"fsd"
NOTIFYMSG COMMOKââ"commok"
NOTIFYMSG COMMBADâ"commbad"
NOTIFYMSG SHUTDOWNââââââ"shutdown"
NOTIFYMSG REPLBATTââââââ"replacebatt"
NOTIFYMSG NOCOMMââ"nocomm"
NOTIFYMSG NOPARENTââââââ"noparent"
NOTIFYFLAG ONLINEâSYSLOG+WALL+EXEC
NOTIFYFLAG ONBATTâSYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATTââââââSYSLOG+WALL+EXEC
NOTIFYFLAG FSDââââââââââSYSLOG+WALL+EXEC
NOTIFYFLAG COMMOKâSYSLOG+WALL+EXEC
NOTIFYFLAG COMMBADââââââSYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWNâââââSYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATTâââââSYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMMâSYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENTâââââSYSLOG+WALL+EXEC
RBWARNTIME 43200
NOCOMMWARNTIME 60
FINALDELAY 15
########### /etc/nut//upssched.conf ###########
CMDSCRIPT /etc/nut/upssched-cmd
PIPEFN /var/state/ups/upssched/upssched.pipe
LOCKFN /var/state/ups/upssched/upssched.lock
AT ONBATT ups at localhost START-TIMER onbatt-timer 10
AT LOWBATT ups at localhost EXECUTE lobatt
AT COMMBAD ups at localhost EXECUTE commbad
AT COMMOK ups at localhost CANCEL-TIMER nocomm-timer
AT COMMOK ups at localhost EXECUTE commok
AT NOCOMM ups at localhost START-TIME nocomm-timer 30
AT SHUTDOWN ups at localhost EXECUTE powerdown
AT FSD ups at localhost EXECUTE fsd
AT NOPARENT ups at localhost EXECUTE noparent
AT REPLBATT ups at localhost EXECUTE replacebatt
AT ONLINE ups at localhost CANCEL-TIMER onbatt-timer
AT ONLINE ups at localhost EXECUTE online
AT ONLINE ups at localhost CANCEL-TIMER heartbeat-failure-timer
AT ONBATT heartbeat at localhost CANCEL-TIMER heartbeat-failure-timer
AT ONBATT heartbeat at localhost START-TIMER heartbeat-failure-timer 660
########### /etc/nut/upssched-cmd ###########
logger -t upsched-cmd: "upsched-cmd running"
UPS="ups at localhost"
STATUS=$( upsc $UPS ups.status)
CHARGE=$( upsc $UPS battery.charge)
CHMSG="[$STATUS] : $CHARGE%"
case $1 in
ââââââonline)
ââââââlogger -t upssched-cmd: "online"
ââââââMSG1="Subject: UPS online"
ââââââMSG2="\nCurrent status: $CHMSG $1"
ââââââcat /etc/nut/online.txt >/tmp/message
ââââââecho -e "$MSG2" >> /tmp/message
ââââââmsmtp -t </tmp/message
;;
ââââââonbatt)
ââââââlogger -t upssched-cmd: "onbatt"
;;
ââââââlowbatt)
ââââââlogger -t upssched-cmd: "lowbatt"
ââââââMSG1="\nUPS low batt - shutting down\n"
ââââââMSG2="Current status: $CHMSG $1"
ââââââcat /etc/nut/lowbatt.txt >/tmp/message
ââââââecho -e "$MSG1 $MSG2" >>/tmp/message
ââââââmsmtp -t </tmp/message
ââââââ/usr/sbin/upsmon -c fsd
;;
ââââââcommok)
ââââââlogger -t upssched-cmd: "commok"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/commok.txt
;;
ââââââcommbad)
ââââââlogger -t upssched-cmd: "commbad"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/commbad.txt
;;
ââââââshutdown)
ââââââlogger -t upssched-cmd: "shutdown"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/shutdown.txt
;;
ââââââreplacebatt)
ââââââlogger -t upssched-cmd: "replacebatt"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/replacebatt.txt
;;
âââââânocomm)
ââââââlogger -t upssched-cmd: "nocomm"
;;
âââââânoparent)
ââââââlogger -t upssched-cmd: "noparent"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/noparent.txt
;;
ââââââfsd)
ââââââlogger -t upssched-cmd: "fsd"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/fsd.txt
;;
ââââââheartbeat-failure-timer)
ââââââlogger -t upssched-cmd: "heart beat fails"
âââââMSG1="\nNUT hearbeat fails"
ââââââMSG2="\nCurrent status: $CHMSG $1"
ââââââMSG3="\n$(ps -elf |grep -E 'ups[dms] |nut')"
ââââââcat /etc/nut/heartbeatfails.txt >/tmp/message
ââââââecho -e "$MSG1 $MSG2 $MSG3" >>/tmp/message
ââââââmsmtp -t </tmp/message
;;
ââââââonbatt-timer)
ââââââlogger -t upssched-cmd: "onbatt-timer-expired"
ââââââMSG1="\nUPS is on battery"
ââââââMSG2="\nCurrent status: $CHMSG $1"
ââââââcat /etc/nut/onbatt.txt >/tmp/message
ââââââecho -e "$MSG1 $MSG2" >>/tmp/message
âââââmsmtp -t </tmp/message
;;
âââââânocomm-timer)
ââââââlogger -t upssched-cmd: "nocomm-timer-expired"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/nocomm.txt
;;
ââââââ*)
ââââââlogger -t upssched-cmd: "unknown command" \"$1\"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/unknowncommand.txt
;;
esac
exit 0
########### /etc/hosts.allow ###########
########### ps -eLf ###########
########### Ownership and permissions of executables ###########
-rwxr-xr-x 1 root root 333348 Jun 9 12:46 /usr/sbin//upsd*
-rwxr-xr-x 1 root root 163600 Jun 9 12:46 /usr/sbin//upsdrvctl*
-rwxr-xr-x 1 root root 6466 Jun 9 12:46 /usr/sbin//upsdrvsvcctl*
-rwxr-xr-x 1 root root 182636 Jun 9 12:46 /usr/sbin//upsmon*
-rwxr-xr-x 1 root root 133088 Jun 9 12:46 /usr/sbin//upssched*
########### Ownership and permissions of configuration files ###########
-rw-r--r-- 1 root root 15269 Jun 7 15:55 /etc/nut//\
-rw-r--r-- 1 root root 89 Jun 7 12:52 /etc/nut//commbad.txt
-rw-r--r-- 1 root root 83 Jun 7 12:52 /etc/nut//commok.txt
-rw-r--r-- 1 root root 79 Jun 7 12:52 /etc/nut//fsd.txt
-rw-r--r-- 1 root root 50 Jun 7 12:52 /etc/nut//heartbeat.conf
-rw-r--r-- 1 root root 64 Jun 9 15:20 /etc/nut//heartbeatfails.txt
-rwxr-xr-x 1 root root 1158 Jun 7 12:52 /etc/nut//hosts.conf*
-rw-r--r-- 1 root root 58 Jun 9 15:12 /etc/nut//lowbatt.txt
-rw-r--r-- 1 root root 85 Jun 7 12:52 /etc/nut//nocomm.txt
-rw-r--r-- 1 root root 79 Jun 7 12:52 /etc/nut//noparent.txt
-rw-r--r-- 1 root root 1544 Jun 7 14:00 /etc/nut//nut.conf
-rw-r--r-- 1 root root 64 Jun 9 15:19 /etc/nut//onbatt.txt
-rw-r--r-- 1 root root 53 Jun 9 14:45 /etc/nut//online.txt
-rw-r--r-- 1 root root 105 Jun 7 12:52 /etc/nut//replacebatt.txt
-rw-r--r-- 1 root root 93 Jun 7 12:52 /etc/nut//shutdown.txt
-rw-r--r-- 1 root root 147 Jun 7 15:11 /etc/nut//start
-rw-r--r-- 1 root root 328 Jun 7 12:52 /etc/nut//stop
-rw-r--r-- 1 root root 71 Jun 7 12:52 /etc/nut//unknowncommand.txt
-rwxr-xr-x 1 root root 5718 Jun 9 15:35 /etc/nut//ups.conf*
-rwxr-xr-x 1 root root 4625 Jun 8 22:10 /etc/nut//upsd.conf*
-rwxr-xr-x 1 root root 4629 Jun 8 15:39 /etc/nut//upsd.conf.bak*
-rwxr-xr-x 1 root root 2619 Jun 7 14:16 /etc/nut//upsd.users*
-rwxr-xr-x 1 root root 15270 Jun 7 15:58 /etc/nut//upsmon.conf*
-rwxr-xr-x 1 root root 2252 Jun 9 15:25 /etc/nut//upssched-cmd*
-rwxr-xr-x 1 root root 2155 Jun 7 15:24 /etc/nut//upssched-cmd.bak*
-rwxr-xr-x 1 root root 4662 Jun 8 20:48 /etc/nut//upssched.conf*
-rw-r--r-- 1 root root 4593 Jun 7 12:52 /etc/nut//upsshed.conf.bak
########### Custom NOTIFYCMD scheduler /etc/nut/upssched-cmd ###########
logger -t upsched-cmd: "upsched-cmd running"
UPS="ups at localhost"
STATUS=$( upsc $UPS ups.status)
CHARGE=$( upsc $UPS battery.charge)
CHMSG="[$STATUS] : $CHARGE%"
case $1 in
ââââââonline)
ââââââlogger -t upssched-cmd: "online"
ââââââMSG1="Subject: UPS online"
ââââââMSG2="\nCurrent status: $CHMSG $1"
ââââââcat /etc/nut/online.txt >/tmp/message
ââââââecho -e "$MSG2" >> /tmp/message
ââââââmsmtp -t </tmp/message
;;
ââââââonbatt)
ââââââlogger -t upssched-cmd: "onbatt"
;;
ââââââlowbatt)
ââââââlogger -t upssched-cmd: "lowbatt"
ââââââMSG1="\nUPS low batt - shutting down\n"
ââââââMSG2="Current status: $CHMSG $1"
ââââââcat /etc/nut/lowbatt.txt >/tmp/message
ââââââecho -e "$MSG1 $MSG2" >>/tmp/message
ââââââmsmtp -t </tmp/message
ââââââ/usr/sbin/upsmon -c fsd
;;
ââââââcommok)
ââââââlogger -t upssched-cmd: "commok"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/commok.txt
;;
ââââââcommbad)
ââââââlogger -t upssched-cmd: "commbad"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/commbad.txt
;;
ââââââshutdown)
ââââââlogger -t upssched-cmd: "shutdown"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/shutdown.txt
;;
ââââââreplacebatt)
ââââââlogger -t upssched-cmd: "replacebatt"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/replacebatt.txt
;;
âââââânocomm)
ââââââlogger -t upssched-cmd: "nocomm"
;;
âââââânoparent)
ââââââlogger -t upssched-cmd: "noparent"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/noparent.txt
;;
ââââââfsd)
ââââââlogger -t upssched-cmd: "fsd"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/fsd.txt
;;
ââââââheartbeat-failure-timer)
ââââââlogger -t upssched-cmd: "heart beat fails"
âââââMSG1="\nNUT hearbeat fails"
ââââââMSG2="\nCurrent status: $CHMSG $1"
ââââââMSG3="\n$(ps -elf |grep -E 'ups[dms] |nut')"
ââââââcat /etc/nut/heartbeatfails.txt >/tmp/message
ââââââecho -e "$MSG1 $MSG2 $MSG3" >>/tmp/message
ââââââmsmtp -t </tmp/message
;;
ââââââonbatt-timer)
ââââââlogger -t upssched-cmd: "onbatt-timer-expired"
ââââââMSG1="\nUPS is on battery"
ââââââMSG2="\nCurrent status: $CHMSG $1"
ââââââcat /etc/nut/onbatt.txt >/tmp/message
ââââââecho -e "$MSG1 $MSG2" >>/tmp/message
âââââmsmtp -t </tmp/message
;;
âââââânocomm-timer)
ââââââlogger -t upssched-cmd: "nocomm-timer-expired"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/nocomm.txt
;;
ââââââ*)
ââââââlogger -t upssched-cmd: "unknown command" \"$1\"
ââââââmsmtp -t dan.grostick at outlook.com </etc/nut/unknowncommand.txt
;;
esac
exit 0
More information about the Nut-upsuser
mailing list