[Nut-upsuser] Support of & amp; amp; amp; quot; shutdown.return& amp; amp; amp; quot; on a APC Back-UPS CS 500

Arjen de Korte nut+users at de-korte.org
Thu Jan 20 16:46:48 UTC 2011

Citeren Kevin <bakdong op gmail.com>:

> On the Smart-UPS 1000, all the instant commands do more or less what  
> you would
> expect. Looking at the timers using "upsc apc1500" I now see that:
>  shutdown.
>    load.off/load.off.delay both set the shutdown timer to 90, shuts down
>      after 90 seconds

It looks like this is the minimum time the UPS allows. On almost every  
other HID PDC UPS we know of, the granularity is much finer than that  
(usually one to ten seconds). It is quite possible that your UPS was  
originally designed with a serial interface (possibly even a dumb one)  
and that the USB interface was added later on. So this may be all the  
underlying hardware supports.

>    reboot sets the reboot timer to 90, sleeps after 90 seconds

Same here.

>    return immediately switches to battery for a moment, sets both shutdown
>      and startup to 90 seconds, sleeps after 90 seconds

That is very odd. You could try what happens if you change the  
'ondelay' and 'offdelay' values in 'ups.conf'. Set offdelay to 1  
second and ondelay to 100/200/400 seconds and run the shutdown.return  
command again (while monitoring the 'ups.timer.shutdown' and  
'ups.timer.start' through upslog or upsc.

>  test.panel and beeper commands also work as expected.
> So you are right, it does seem to be working on this model. I don't  
> know why I
> didn't see this when I was testing originally. Also I don't  
> understand why the
> shutdown.return, which seems to be translated to "load.on.delay,  
> load.off.delay"
> is used in preference to the "shutdown.reboot" command.

According to the USB HID PDC specifications, the 'reboot n' command  
will kill the power immediately and return after 'n' seconds if power  
is present or will wait until the power returns if it wasn't. We  
prefer to have a little grace period, so that's why we do the two step  
approach of setting both the shutdown and (re)start timers.

By setting a restart timer longer than the shutdown timer, this  
effectively allows for a grace period until the UPS switches off. From  
then it behaves like a reboot command. You need this grace period if  
you want your system to hibernate instead of shutdown, since the Linux  
kernel doesn't allow calling hooks just before it powers off the system.

Apparently, due to the dreadful granularity of your UPS hardware  
timers the commands we send

     load.on.delay 30
     load.off.delay 20

are interpreted as setting both to 90 seconds. Worse, since the  
ups.timer.start elapses before the ups.timer.shutdown, this  
effectively puts the UPS to sleep.

> On the CS 500 the load.off switches it off immediately, the load.off delay,
> shutdown.return and shutdown.stayoff all switch to battery, and set  
> the shutdown
> timer to 20 seconds and then shuts down after that time. (Never restarts) The
> beeper commands work, as does the shutdown.stop (sets the shutdown  
> timer to -1)

This probably requires some remapping of variables. I'll see if I can  
find a solution for that.

Best regards, Arjen
Please keep list traffic on the list (off-list replies will be rejected)

More information about the Nut-upsuser mailing list