[Nut-upsuser] Startup timing issue with CyberPower CP425HG UPS

Charles Lepple clepple at gmail.com
Fri Apr 1 02:25:43 UTC 2011

On Mar 30, 2011, at 9:46 PM, Arun wrote:

> I'm not sure how to fix this, other than to perhaps start the "ups"  
> service from the udev rules file if a known USB UPS device has been  
> found, but that seems like a rather ugly way to go about this. Does  
> anyone have any thoughts?

I have had a sneaking suspicion that in some situations, starting a  
USB driver from hotplug or udev might work better, and this is  
definitely one of those cases.

Before you get too far into this, you probably want to make sure that  
when power returns, your UPS will wait until the battery is charged to  
some threshold before powering on its outlets. Otherwise, if the power  
goes off-on-off (with a shutdown after the first power failure), the  
UPS might try to start the computer up with a discharged battery, and  
due to the delay in connecting to the UPS, NUT would not get the low  
battery signal in time to shut down properly the second time.

The other trick is that the current NUT USB drivers will attempt to  
reattach to a device if it disappears. Especially during testing, it  
is helpful to be able to unplug and re-plug the UPS into the USB port.  
For this to work, the udev script could kill the driver which is  
waiting around for the UPS to come back. (That would only do the right  
thing on a single-UPS system.) Alternatively, you could check in the  
udev script to see if any of the USB drivers are running (look for the  
PID files, and run "kill -0" to see if the process is still around  
without actually terminating it).

On the other hand, you can also look into whether your startup scripts  
have configurable dependencies, and tell the NUT init.d script to  
start after the USB service has fully initialized. Not sure how that  
works in Fedora.

More information about the Nut-upsuser mailing list