In my case which is a UPS connected via a serial port. it appears to be a timing problem - looks like upsmon is not ready when upsdrvctl is executed in the standard init.d/nut script but am not entirely sure of that since I have not looked at the upsdrvctl code. Anyway. as a workaround, modified the nut script function start_stop_server "start" case paragraph to start upsd first and upsdrvctl second with a 30 second pause between as follows :-
Then it works reliably. 15 Seconds is not enough, 30 seconds is sufficient but may be too much - probably not the most elegant solution but I'm happy with it. If the developer would like me to try other solutions, I'm happy to assist.
In my case which is a UPS connected via a serial port. it appears to be a timing problem - looks like upsmon is not ready when upsdrvctl is executed in the standard init.d/nut script but am not entirely sure of that since I have not looked at the upsdrvctl code. Anyway. as a workaround, modified the nut script function start_stop_server "start" case paragraph to start upsd first and upsdrvctl second with a 30 second pause between as follows :-
start)
start- stop-daemon -S -q -p $upsd_pid -x $upsd \
log_ progress_ msg "(driver(s) failed)" || log_progress_msg "driver(s)"
-- $UPSD_OPTIONS >/dev/null 2>&1
sleep 30
! $upsdrvctl start >/dev/null 2>&1 && \
;;
Then it works reliably. 15 Seconds is not enough, 30 seconds is sufficient but may be too much - probably not the most elegant solution but I'm happy with it. If the developer would like me to try other solutions, I'm happy to assist.