Hi, I have problem with upssched on windows. Upssched is not executed. I have 2 scripts, 1 for notification in upsmon and second for scheduling in upssched. Monitoring is working fine, script write to log. I'm using binary windows installer 2.6.5-6 from NUT. Here are my configs: --- nut.conf MODE=netclient --- upsmon.conf MONITOR ups_1000 at 192.168.3.95 1 <user> <password> slave MINSUPPLIES 1 SHUTDOWNCMD "C:\\WINDOWS\\system32\\shutdown.exe /t 600 /s /d u:6:11" NOTIFYCMD C:\\NUT\\notify.cmd POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 POWERDOWNFLAG C:\\NUT\\killpower NOTIFYMSG ONLINE "UPS %s on line power" NOTIFYMSG ONBATT "UPS %s on battery" NOTIFYMSG LOWBATT "UPS %s battery is low" NOTIFYMSG FSD "UPS %s: forced shutdown in progress" NOTIFYMSG COMMOK "Communications with UPS %s established" NOTIFYMSG COMMBAD "Communications with UPS %s lost" NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding" NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced" NOTIFYMSG NOCOMM "UPS %s is unavailable" NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible" NOTIFYFLAG ONLINE SYSLOG+EXEC NOTIFYFLAG ONBATT SYSLOG+EXEC NOTIFYFLAG LOWBATT SYSLOG+EXEC NOTIFYFLAG FSD SYSLOG+EXEC NOTIFYFLAG COMMOK SYSLOG+EXEC NOTIFYFLAG COMMBAD SYSLOG+EXEC NOTIFYFLAG SHUTDOWN SYSLOG+EXEC NOTIFYFLAG REPLBATT SYSLOG+EXEC NOTIFYFLAG NOCOMM SYSLOG+EXEC NOTIFYFLAG NOPARENT SYSLOG+EXEC RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 5 --- upssched.conf CMDSCRIPT "cmd.exe /C C:\\NUT\\sched.cmd" PIPEFN "C:\\NUT\\upssched.pipe" LOCKFN "C:\\NUT\\upssched.lock" AT ONBATT * EXECUTE onbattnow AT ONBATT * START-TIMER onbattwarn 30 AT ONLINE * EXECUTE ups-back-on-line AT ONLINE * CANCEL-TIMER onbattwarn --- notify.cmd @ECHO OFF For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%b.%%a.%%c) For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b) echo [%mydate%-%mytime%] %1 %2 %3 %4 >> C:\\NUT\\notify.log --- output in notify.log [10.03.2020-10:56 AM] "UPS ups_1000 at 192.168.3.95 on battery" [10.03.2020-11:00 AM] C:\NUT\notify.cmd "UPS ups_1000 at 192.168.3.95 on line power" [10.03.2020-11:15 AM] "UPS ups_1000 at 192.168.3.95 battery is low" [10.03.2020-12:23 PM] "UPS ups_1000 at 192.168.3.95 on battery" [10.03.2020-12:24 PM] "UPS ups_1000 at 192.168.3.95: forced shutdown in progress" [10.03.2020-12:24 PM] "Auto logout and shutdown proceeding" [10.03.2020-12:25 PM] "Communications with UPS ups_1000 at 192.168.3.95 lost" [10.03.2020-12:25 PM] "UPS ups_1000 at 192.168.3.95 is unavailable" [10.03.2020-12:30 PM] "UPS ups_1000 at 192.168.3.95 is unavailable" [10.03.2020-12:35 PM] "UPS ups_1000 at 192.168.3.95 is unavailable" [10.03.2020-12:40 PM] "UPS ups_1000 at 192.168.3.95 is unavailable" [10.03.2020-12:45 PM] "UPS ups_1000 at 192.168.3.95 is unavailable" [10.03.2020-12:49 PM] "UPS ups_1000 at 192.168.3.95 battery is low" [10.03.2020-12:55 PM] "Communications with UPS ups_1000 at 192.168.3.95 lost" [10.03.2020-12:55 PM] "Communications with UPS ups_1000 at 192.168.3.95 established" [10.03.2020-01:04 PM] "UPS ups_1000 at 192.168.3.95 battery is low" --- sched.cmd @ECHO OFF For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%b.%%a.%%c) For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b) echo [%mydate%-%mytime%] %1 %2 >> C:\\NUT\\sched.log Script sched.cmd is never executed, and I can't instruct windows client to early shut down. Any help ? Thanks. ________________________________ s pozdravom Radoslav Chovan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20200310/a5f7427b/attachment.html>
On Tue, 10 Mar 2020, Radoslav Chovan wrote:> I have problem with upssched on windows. Upssched is not executed. I > have 2 scripts, 1 for notification in upsmon and second for scheduling > in upssched. Monitoring is working fine, script write to log. I'm > using binary windows installer 2.6.5-6 from NUT.> --- upsmon.conf > MONITOR ups_1000 at 192.168.3.95 1 <user> <password> slave > MINSUPPLIES 1 > SHUTDOWNCMD "C:\\WINDOWS\\system32\\shutdown.exe /t 600 /s /d u:6:11" > NOTIFYCMD C:\\NUT\\notify.cmdNOTIFYCMD would normally point to the executable upssched binary.> --- upssched.conf > CMDSCRIPT "cmd.exe /C C:\\NUT\\sched.cmd" > PIPEFN "C:\\NUT\\upssched.pipe" > LOCKFN "C:\\NUT\\upssched.lock" > AT ONBATT * EXECUTE onbattnow > AT ONBATT * START-TIMER onbattwarn 30 > AT ONLINE * EXECUTE ups-back-on-line > AT ONLINE * CANCEL-TIMER onbattwarn > > --- notify.cmd > @ECHO OFF > For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%b.%%a.%%c) > For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b) > echo [%mydate%-%mytime%] %1 %2 %3 %4 >> C:\\NUT\\notify.logI don't recognise this language, but the notifications should probably be called from your script sched.cmd if you call the upssched binary.> --- sched.cmd > @ECHO OFF > For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%b.%%a.%%c) > For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b) > echo [%mydate%-%mytime%] %1 %2 >> C:\\NUT\\sched.logRoger
ut 10. 3. 2020 o 16:34 Roger Price <roger at rogerprice.org> napísal(a):> > On Tue, 10 Mar 2020, Radoslav Chovan wrote: > > > I have problem with upssched on windows. Upssched is not executed. I > > have 2 scripts, 1 for notification in upsmon and second for scheduling > > in upssched. Monitoring is working fine, script write to log. I'm > > using binary windows installer 2.6.5-6 from NUT. > > > --- upsmon.conf > > MONITOR ups_1000 at 192.168.3.95 1 <user> <password> slave > > MINSUPPLIES 1 > > SHUTDOWNCMD "C:\\WINDOWS\\system32\\shutdown.exe /t 600 /s /d u:6:11" > > NOTIFYCMD C:\\NUT\\notify.cmd > > NOTIFYCMD would normally point to the executable upssched binary.upssched binnary on windows does not have .exe suffix, and original binary upssched-cmd is not executed (monitored with procexp), so I've copied original upssched-cmd to upssched-cmd.exe and modified upsmon.conf to: NOTIFYCMD C:\\NUT\\bin\\upssched-cmd.exe output of sched.log: [11.03.2020-09:08 AM] commbad [11.03.2020-09:08 AM] commok [11.03.2020-09:10 AM] commbad [11.03.2020-09:11 AM] commok [11.03.2020-09:12 AM] commbad [11.03.2020-09:12 AM] commok But now, when upssched is working, notification is not logged, I mean, that I can't log notification to file, as I was able with my own script. With upssched I have only command, not ups name or description text.> > > --- upssched.conf > > CMDSCRIPT "cmd.exe /C C:\\NUT\\sched.cmd" > > PIPEFN "C:\\NUT\\upssched.pipe" > > LOCKFN "C:\\NUT\\upssched.lock" > > AT ONBATT * EXECUTE onbattnow > > AT ONBATT * START-TIMER onbattwarn 30 > > AT ONLINE * EXECUTE ups-back-on-line > > AT ONLINE * CANCEL-TIMER onbattwarn > > > > --- notify.cmd > > @ECHO OFF > > For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%b.%%a.%%c) > > For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b) > > echo [%mydate%-%mytime%] %1 %2 %3 %4 >> C:\\NUT\\notify.log > > I don't recognise this language, but the notifications should probably be called > from your script sched.cmd if you call the upssched binary.this is windows command line (shell) language> > > --- sched.cmd > > @ECHO OFF > > For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%b.%%a.%%c) > > For /f "tokens=1-2 delims=/:" %%a in ('time /t') do (set mytime=%%a:%%b) > > echo [%mydate%-%mytime%] %1 %2 >> C:\\NUT\\sched.log > > Roger_______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at alioth-lists.debian.net > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser