[Nut-upsuser] Restarting NUT twice in the same time creates 2 instances of usbhid-ups driver

Arjen de Korte nut+users at de-korte.org
Thu Jun 23 09:53:46 UTC 2011


Citeren Raphaël <raphael.broutin op ve-hotech.com>:

> When reading /etc/init.d/nut, i see that when restarting nut, script  
> stop nut and start it again.
> When starting again the driver is one more time started without any  
> verification that its already launched.

Stopping a driver is an asynchronous process. So you either have to  
check if the PID file is removed before assuming the driver has  
actually stopped or you need to wait a couple of seconds before  
(re)starting the drivers.

> I think there is a problem in code there.

This is an inherent effect of the method that is used to signal  
drivers to stop. On systems with multiple driver instances, you don't  
want to hang around waiting for a driver to actually stop before going  
to the next one.

> have you a solution to bypass this problem without rewriting /etc/init.d/nut

The easiest fix is to add a delay between

    stop nut
    sleep 2
    start nut

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





More information about the Nut-upsuser mailing list