> > Did you see a line in the journal similar to this ? > Oct 06 22:49:54 pinta nut-delayed-ups-shutdown[1854]: > nut-delayed-ups-shudown.service calling > upsdrvctl to shut down UPS unitNever after I disabled the service. I pasted the whole journal section of the successful shutdown from last email. However I have been thinking about this line in upssched-cmd: ${sbinPath}upsmon -c fsd In 'upsmon --help' I read: "- fsd: shutdown all master UPSes (use with caution)". What exactly does this line do? What does "mesg" report? It says "is n". I decided to make a simple test with this script named test: #!/bin/bash MSG0=$'test' echo $MSG0 | /usr/bin/wall echo "abc" If I run it as root, there is a notification - both in console and in KDE and "abc" in console. But if I attempt to run the test script it as upsd: su - upsd -c "./test" the result is only silence. I checked permissions, it should run: -rwxr-xr-x 1 upsd daemon 63 Oct 28 20:02 /etc/ups/test* -rwxr-xr-x 1 root tty 27480 Mar 13 2015 /usr/bin/wall* I also tried to run it with mesg set to 'y' but with same lack of success. Its systemd trying to "help" you. OpenSUSE 13.2 includes a delayed UPS> shutdown script in /usr/lib/systemd/system-shutdown/nutshutdown . I suggest > you comment out the command in that script.Done. Now the UPS doesn't turn off. However I will restore it as it seems useful to have it off when and only when the shutdown is evoked by a real power failure but not during normal reboot/shutdown. That seems exactly what I wanted. Endless repetitions of (Communication lost - Communication re-established):> its been reported before in this mailing list for various drivers, and > others may know what causes it. I suggest opening a new issue in this > mailing list with a specific technical description.Will do. Thanks! --- George -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20151028/1e076c9f/attachment-0001.html>
P.S. There is a typo in your nut-delayed-ups-shutdown.service. Line: ExecStart=/usr/bin/logger -t upsdrvctl "nut-delayed-ups-shudown.service calling upsdrvctl to shut down UPS unit" shudown is missing a 't'. It is in the log message but might still be worth fixing for grepping. BTW why is that service in /etc/systemd/system/ and not in /usr/lib/systemd/system/ ? --- George -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20151028/43cded3b/attachment.html>
P.S.2 Today I experienced something weird. As I was working, the system started a shutdown and did shut down, then the UPS got powered off and then back on - an expected behavior for a power fail situation. However there was no power failure! I ran nut-journal to check what happened: Previous complete boot through shutdown Oct 29 10:09:33 i7 upsdrvctl[1966]: Using subdriver: MGE HID 1.32 Oct 29 10:09:34 i7 upsdrvctl[1966]: Network UPS Tools - Generic HID driver 0.38 (2.7.1) Oct 29 10:09:34 i7 upsdrvctl[1966]: USB communication driver 0.32 Oct 29 10:09:35 i7 upsdrvctl[1966]: Network UPS Tools - UPS driver controller 2.7.1 Oct 29 10:09:35 i7 upsd[2235]: fopen /var/lib/ups/upsd.pid: No such file or directory Oct 29 10:09:35 i7 upsd[2235]: listening on ::1 port 3493 Oct 29 10:09:35 i7 upsd[2235]: listening on ::1 port 3493 Oct 29 10:09:35 i7 upsd[2235]: listening on 127.0.0.1 port 3493 Oct 29 10:09:35 i7 upsd[2235]: Connected to UPS [myups]: usbhid-ups-myups Oct 29 10:09:35 i7 upsd[2235]: listening on 127.0.0.1 port 3493 Oct 29 10:09:35 i7 upsd[2235]: Connected to UPS [myups]: usbhid-ups-myups Oct 29 10:09:35 i7 upsd[2236]: Startup successful Oct 29 10:09:35 i7 upsmon[2237]: fopen /var/run/upsmon.pid: No such file or directory Oct 29 10:09:35 i7 upsmon[2237]: UPS: myups at localhost (master) (power value 1) Oct 29 10:09:35 i7 upsmon[2237]: Using power down flag file /etc/ups/killpower Oct 29 10:09:35 i7 upsmon[2238]: Startup successful Oct 29 10:09:35 i7 upsd[2236]: User upsmaster@::1 logged into UPS [myups] Oct 29 10:46:46 i7 upsmon[2239]: UPS myups at localhost battery is low Oct 29 10:46:46 i7 upssched[3581]: Executing command: ups-low-battery Oct 29 10:46:46 i7 upssched-cmd[3583]: Calling upssched-cmd ups-low-battery Oct 29 10:46:46 i7 upssched-cmd[3584]: Unrecognized command: ups-low-battery Oct 29 10:46:46 i7 upssched[3585]: Timer daemon started Oct 29 10:46:46 i7 upssched[3585]: New timer: shutdown-timer (35 seconds) Oct 29 10:47:21 i7 upssched[3585]: Event: shutdown-timer Oct 29 10:47:21 i7 upssched-cmd[3593]: Calling upssched-cmd shutdown-timer Oct 29 10:47:21 i7 upssched-cmd[3594]: Shutdown timer reached: Calling upsmon -c fsd Oct 29 10:47:21 i7 upsmon[2239]: Signal 10: User requested FSD Oct 29 10:47:21 i7 upsd[2236]: Client upsmaster@::1 set FSD on UPS [myups] Oct 29 10:47:21 i7 upsmon[2239]: Executing automatic power-fail shutdown Oct 29 10:47:21 i7 upsmon[2239]: Auto logout and shutdown proceeding Oct 29 10:47:26 i7 upsmon.conf[3602]: SHUTDOWNCMD calling /sbin/shutdown to shut down system Oct 29 10:47:26 i7 upsd[2236]: mainloop: Interrupted system call Oct 29 10:47:26 i7 upsd[2236]: Signal 15: exiting Oct 29 10:47:26 i7 upsdrvctl[3651]: Network UPS Tools - UPS driver controller 2.7.1 Oct 29 10:47:32 i7 systemd-journal[523]: Journal stopped It seems NUT has executed a shutdown because of low battery. However the battery was at 100% before shutdown and right after boot. I suspect this is just another case of those false positive alarms (disconnects/reconnects) which happen randomly and are also sometimes accompanied by messages for low battery (instantly followed by a message of battery ok). So I removed the +EXEC on certain lines in upsmon.conf: NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC NOTIFYFLAG LOWBATT SYSLOG+WALL NOTIFYFLAG FSD SYSLOG+WALL+EXEC NOTIFYFLAG COMMOK SYSLOG+WALL NOTIFYFLAG COMMBAD SYSLOG+WALL NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC NOTIFYFLAG REPLBATT SYSLOG+WALL NOTIFYFLAG NOCOMM SYSLOG+WALL NOTIFYFLAG NOPARENT SYSLOG+WALL+EXEC Can you confirm if that is enough as a measure not to initiate shutdown on low battery without actual power failure? Also - what would be the proper config to *execute* a shutdown if there is a low battery but *only* when there is an actual power failure situation (i.e. the UPS is running on battery power)? [I suppose that might work for the "optimistic" setup] --- George -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20151029/ca14a48b/attachment.html>
On Wed, 28 Oct 2015, George Anchev wrote:> ?${sbinPath}upsmon -c fsd > In 'upsmon --help' I read: "- fsd: shutdown all master UPSes (use with > caution)". What exactly does this line do?My understanding is that it calls upsmon running as root to execute the command specified by SHUTDOWNCMD in upsmon.conf, and that it checks that it is running as root.> I decided to make a simple test with this script named test: > > #!/bin/bash > MSG0=$'test' > echo $MSG0 | /usr/bin/wall > echo "abc" > > If I run it as root, there is a notification - both in console and in > KDE and "abc" in console. But if I attempt to run the test script it as > upsd: > su - upsd -c "./test" > the result is only silence.Its upsmon which executes the shutdown command, not upsd. upsmon only accepts the -c values it understands, and will remind you of this if you try something else. I don't know if upsmon is running as root or upsd when it calls wall for a shutdown. If it is running as upsd then there could be a problem. Roger
> > I don't know if upsmon is running as root or upsd when it calls wall for a > shutdown. If it is running as upsd then there could be a problem.It seems running as upsd, otherwise it makes no sense not to work. However upsd user doesn't have a shell (I see /bin/false as it's shell in YaST > Users and Group Management which might be the reason for it not being able to execute shell commands such as echo or wall. Does it actually work for you? Can you suggest another way of notifications so that everything works? Thanks. --- George Anchev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20151029/738d4a5a/attachment.html>
On Wed, 28 Oct 2015, George Anchev wrote:> P.S. There is a typo in your?nut-delayed-ups-shutdown.service. Line: > ExecStart=/usr/bin/logger -t upsdrvctl "nut-delayed-ups-shudown.service calling upsdrvctl to shut down UPS unit" > > shudown is missing a 't'. It is in the log message but might still be worth fixing for grepping.Thanks! Fixed.> BTW why is that service in /etc/systemd/system/ and not in?/usr/lib/systemd/system/ ?Its quite possible that I put nut-delayed-ups-shutdown.service in the wrong place. systemd is not evident. Roger