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

Roger Price roger at rogerprice.org
Tue Mar 10 15:34:26 GMT 2020


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.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.

> --- 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


More information about the Nut-upsuser mailing list