Dmitry Ogorodnikov
2012-Apr-11 04:06 UTC
[Nut-upsuser] NOTIFYCMD doesn't work from Windows service
Hello dear all, I try to use NUT for windows (not WinNUT), and stuck with launching NOTIFYCMD. On any event marked as SYSLOG+WALL+EXEC syslog entry appears, popup window appears, but NOTIFYCMD script doesn't run. If I run upsmon.exe in cmd (i. e. not as a service) everything works fine. Here is my upsmon.conf: MONITOR central at 10.35.0.180 1 user password slave MINSUPPLIES 1 SHUTDOWNCMD "C:\\NUT\\shutdown.bat" NOTIFYCMD "C:\\NUT\\shutdown.bat" POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 POWERDOWNFLAG "C:\\killpower" NOTIFYMSG ONLINE ONLINE NOTIFYMSG ONBATT ONBATT NOTIFYMSG LOWBATT LOWBATT NOTIFYMSG FSD FSD NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC NOTIFYFLAG FSD SYSLOG+WALL+EXEC RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 5 I also tried NOTIFYCMD C:\\NUT\\shutdown.bat NOTIFYCMD "\"C:\\NUT\\shutdown.bat"" with no success. NUT 2.6.1-1 with replaced upsmon.exe from here: http://fbohe.free.fr/upsmon.exe. Windows 2003 R2 x64 Rusian. Master server is Debian Squeeze. Regards, Dmitry
Frédéric Bohé
2012-Apr-16 13:57 UTC
[Nut-upsuser] NOTIFYCMD doesn't work from Windows service
Hello Dmitry, On Wed, 2012-04-11 at 15:06 +1100, Dmitry Ogorodnikov wrote:> Hello dear all, > > I try to use NUT for windows (not WinNUT), and stuck with launching NOTIFYCMD. > On any event marked as SYSLOG+WALL+EXEC syslog entry appears, popup > window appears, but NOTIFYCMD script doesn't run. > If I run upsmon.exe in cmd (i. e. not as a service) everything works fine.I have just checked and it works with the NUT 2.6.1-1 package binaries. However, I noticed 2 important things: - the notify command is called only after clicking OK on the upsmon's dialog box. This is not the expected behavior and I will fix that immediately. In the mean time you can disable this dialog box by removing the "WALL" flag of the corresponding NOTIFYFLAG command. - the called notify command do not appear on the user's desktop, neither with a GUI nor with a console. But you can check that it has been called with Windows' task manager. This happens because the notify command is called by the user SYSTEM which has no graphical display available (no desktop). So the notify command should not try to display information directly. Maybe there is a way to workaround this using runas but I have not managed to find it yet. Thanks for your input. Regards, Fred> > Here is my upsmon.conf: > > MONITOR central at 10.35.0.180 1 user password slave > MINSUPPLIES 1 > SHUTDOWNCMD "C:\\NUT\\shutdown.bat" > NOTIFYCMD "C:\\NUT\\shutdown.bat" > POLLFREQ 5 > POLLFREQALERT 5 > HOSTSYNC 15 > DEADTIME 15 > POWERDOWNFLAG "C:\\killpower" > NOTIFYMSG ONLINE ONLINE > NOTIFYMSG ONBATT ONBATT > NOTIFYMSG LOWBATT LOWBATT > NOTIFYMSG FSD FSD > NOTIFYFLAG ONLINE SYSLOG+WALL+EXEC > NOTIFYFLAG ONBATT SYSLOG+WALL+EXEC > NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC > NOTIFYFLAG FSD SYSLOG+WALL+EXEC > RBWARNTIME 43200 > NOCOMMWARNTIME 300 > FINALDELAY 5 > > I also tried > NOTIFYCMD C:\\NUT\\shutdown.bat > NOTIFYCMD "\"C:\\NUT\\shutdown.bat"" > with no success. > > NUT 2.6.1-1 with replaced upsmon.exe from here: http://fbohe.free.fr/upsmon.exe. > Windows 2003 R2 x64 Rusian. > Master server is Debian Squeeze. > > Regards, > Dmitry > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser-- Team Open Source Eaton - http://powerquality.eaton.com --------------------------------------------------------------------------