William R. Elliot
2012-Feb-09 22:44 UTC
[Nut-upsdev] How to cause a local system shutdown...
Hi all. I'm working on an update to the ONEAC driver and have a request from a user that I am not sure how to handle. The UPS can be communicated with through a couple different methods (e.g. Serial, network). If a UPS shutdown command comes through the network interface, the user wants NUT (serial connection) to signal the supported systems to shutdown. What is the "right" way to do this? One thought was to trigger the LB status if the shutdown counter was ever found to be non-zero. Would that work? What other options should be considered? Thanks, Bill
On Feb 9, 2012, at 5:44 PM, William R. Elliot wrote:> Hi all. I'm working on an update to the ONEAC driver and have a request from a user that I am not sure how to handle. > > The UPS can be communicated with through a couple different methods (e.g. Serial, network). If a UPS shutdown command comes through the network interface, the user wants NUT (serial connection) to signal the supported systems to shutdown. > > What is the "right" way to do this? One thought was to trigger the LB status if the shutdown counter was ever found to be non-zero. Would that work? What other options should be considered?Hi Bill, I'll be honest - all of my NUT experience has been with UPS hardware that only support a single active control connection (and all of the fan-out is handled by upsd). That said, I think a slightly different status flag (FSD) would be the right way to go: http://www.networkupstools.org/docs/developer-guide.chunked/ar01s09.html#_fsd That links to a chapter on the network protocol, where an appropriately privileged NUT client can set the FSD flag in upsd's status. But based on the commentary there, it seems to be equivalent to the on-battery/low-battery status-- without the minor confusion of seeing "low battery" messages in the logs (when the battery might not actually be low). There is additional code in the server to reflect FSD to other clients in the status (since the server-side flag is kept in a separate per-UPS variable), but I don't think it would conflict with using it in a driver. Hope this helps. Feel free to post patches if you have any questions about implementing this. -- Charles Lepple clepple at gmail