[Nut-upsuser] Fwd: Windows upssched does not work

Radoslav Chovan radoslav at chovan.net
Wed Mar 11 08:18:22 GMT 2020


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



More information about the Nut-upsuser mailing list