[Nut-upsuser] Getting two notifications of nocomm-timer expired when USB cable is pulled from the UPS

Dan Grostick danpower2023 at outlook.com
Fri Feb 23 15:15:27 GMT 2024


NUT 2.8.01

When I pull the USB cable from the UPS, I get two notifications of the nocomm-timer expired.  The first notification is in the proper sequence, the second notification occurs after 'commok' occurs. Seems somehow that upssched-cmd is getting a second nocomm-timer expired delayed.
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20240223/6ddbbe12/attachment.htm>
-------------- next part --------------
Feb 23 09:41:25 windows10production kernel: [66939.326838] usb 1-1.2: USB disconnect, device number 5
Feb 23 09:41:29 windows10production upssched-cmd:: 2024-02-23_09.41.29 upssched-cmd running
Feb 23 09:41:29 windows10production upssched-cmd:: commbad
Feb 23 09:42:07 windows10production upssched-cmd:: 2024-02-23_09.42.07 upssched-cmd running
Feb 23 09:42:07 windows10production upssched-cmd:: nocomm-timer-expired
Feb 23 09:42:11 windows10production kernel: [66985.190489] usb 1-1.2: new full-speed USB device number 6 using dwc_otg
Feb 23 09:42:11 windows10production kernel: [66985.323897] usb 1-1.2: New USB device found, idVendor=0764, idProduct=0501, bcdDevice= 0.01
Feb 23 09:42:11 windows10production kernel: [66985.323931] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 23 09:42:11 windows10production kernel: [66985.323945] usb 1-1.2: Product: CRCA102-3I1
Feb 23 09:42:11 windows10production kernel: [66985.323956] usb 1-1.2: Manufacturer: CP1500PFCLCD
Feb 23 09:42:11 windows10production kernel: [66985.323966] usb 1-1.2: SerialNumber: CPS
Feb 23 09:42:11 windows10production kernel: [66985.351169] hid-generic 0003:0764:0501.0003: hiddev96,hidraw0: USB HID v1.10 Device [CP1500PFCLCD CRCA102-3I1] on usb-3f980000.usb-1.2/input0
Feb 23 09:42:11 windows10production mtp-probe: checking bus 1, device 6: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2"
Feb 23 09:42:11 windows10production mtp-probe: bus: 1, device: 6 was not an MTP device
Feb 23 09:42:11 windows10production mtp-probe: checking bus 1, device 6: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2"
Feb 23 09:42:11 windows10production mtp-probe: bus: 1, device: 6 was not an MTP device
Feb 23 09:42:13 windows10production upssched-cmd:: 2024-02-23_09.42.13 upssched-cmd running
Feb 23 09:42:13 windows10production upssched-cmd:: commok
Feb 23 09:42:31 windows10production upssched-cmd:: 2024-02-23_09.42.31 upssched-cmd running
Feb 23 09:42:31 windows10production upssched-cmd:: nocomm-timer-expired
-------------- next part --------------
CMDSCRIPT /etc/nut/upssched-cmd

PIPEFN /var/state/ups/upssched/upssched.pipe

LOCKFN /var/state/ups/upssched/upssched.lock





AT ONBATT   ups at localhost  EXECUTE onbatt
AT ONBATT   ups at localhost  START-TIMER onbatt-timer 10
AT ONBATT   ups at localhost  CANCEL-TIMER lowbatt-timer
AT ONBATT   ups at localhost  CANCEL-TIMER shutdown-timer
AT ONBATT   ups at localhost  START-TIMER beeperoff 60
AT ONBATT   ups at localhost  EXECUTE beeperon
AT LOWBATT  ups at localhost  EXECUTE lowbatt
AT LOWBATT  ups at localhost  START-TIMER shutdown-timer 125
AT COMMBAD  ups at localhost  EXECUTE commbad
AT COMMOK   ups at localhost  EXECUTE  commok
AT COMMOK   ups at localhost  CANCEL-TIMER nocomm-timer
AT NOCOMM   ups at localhost  START-TIMER nocomm-timer 30
AT SHUTDOWN ups at localhost  EXECUTE powerdown
AT FSD      ups at localhost  EXECUTE fsd
AT NOPARENT ups at localhost  EXECUTE noparent
AT REPLBATT ups at localhost  EXECUTE replacebatt
AT ONLINE   ups at localhost  CANCEL-TIMER onbatt-timer
AT ONLINE   ups at localhost  CANCEL-TIMER shutdown-timer
AT ONLINE   ups at localhost  EXECUTE online
AT ONBATT   heartbeat at localhost  CANCEL-TIMER heartbeat-failure-timer
AT ONBATT   heartbeat at localhost  START-TIMER heartbeat-failure-timer 660
-------------- next part --------------
#echo >/tmp/message

logger -t  upssched-cmd: "$NOW" upssched-cmd running

case $1 in
        online)
        logger -t upssched-cmd: "online"
        if [ test -f $FILE ]; then
        echo
        else
        rm -f $FILE1
        rm -f $FILE2
        rm -f $FILE3
        rm -f $FILE4
        rm -f $FILE5
        echo >$FILE
        MSG2="\nCurrent status: $CHMSG  $1"
        cat /etc/nut/online.txt >/tmp/message
        cat /tmp/message >>/etc/nut/logfile
        logger -t upssched-cmd: "online"
        echo -e "$MSG2" >> /tmp/message
        /usr/bin/msmtp -t dan.grostick at outlook.com </tmp/message
        fi

;;

        onbatt)
        rm $FILE
        cat /etc/nut/onbatt.txt >>/etc/nut/logfile
        logger -t upssched-cmd: "onbatt"
        echo ""
        /usr/bin/msmtp -t  </etc/nut/onbatt.txt
;;

        lowbatt)
        logger -t upssched-cmd: "lowbatt"
        MSG1="\nUPS low batt \n"
        MSG2="Current status: $CHMSG $1"
        cat /etc/nut/lowbatt.txt >/tmp/message
        cat /tmp/message >>/etc/nut/logfile
        echo -e "$MSG1 $MSG2" >>/tmp/message
        /usr/bin/msmtp -t < dan.grostick at outlook.com /tmp/message
;;

        commok)
        rm -f $FILE3
        cat /etc/nut/commok.txt >>/etc/nut/logfile
        logger -t upssched-cmd: "commok"
        msmtp -t dan.grostick at outlook.com </etc/nut/commok.txt
;;

        commbad)
        logger -t upssched-cmd: "commbad"
        if [ test -f $FILE3 ]; then
        echo
        else
        echo > $FILE3
        cat /etc/nut/commbad.txt >>/etc/nut/logfile
        msmtp -t dan.grostick at outlook.com </etc/nut/commbad.txt
        fi
;;

        shutdown-timer)
        logger -t upssched-cmd: "shutdown"
        cat /etc/nut/shutdown.txt >>/etc/nut/logfile
        msmtp -t dan.grostick at outlook.com </etc/nut/shutdown.txt
;;

        beeperon)
        logger -t upssched-cmd: "Turning  beeper on"
                upscmd -u ${UPS_USERNAME} -p ${UPS_PASSWORD} ${UPS} beeper.enable
;;

        beeperoff)
        CSTATUS=`upsc ${UPS} ups.beeper.status 2>&1`
        if [ "${CSTATUS}" == "enabled" ] ; then
        logger -t upssched-cmd: "Turning beeper off"
                upscmd -u ${UPS_USERNAME} -p ${UPS_PASSWORD} ${UPS} beeper.disable
        fi


;;
        replacebatt)
        logger -t upssched-cmd: "replacebatt"
        if [ test -f $FILE2 ]; then
        echo
        else
        echo > $FILE2
        cat /etc/nut/replacebatt.txt >>/etc/nut/logfile
        msmtp -t dan.grostick at outlook.com </etc/nut/replacebatt.txt
        fi
;;

        nocomm)
        logger -t upssched-cmd: "nocomm"
        if [ test -f $FILE1 ]; then
        echo
        else
        echo > $FILE1
        cat /etc/nut/nocomm.txt >>/etc/nut/logfile
        msmtp -t dan.grostick at outlook.com </etc/nut/nocomm.txt
        fi
;;


        noparent)
        logger -t upssched-cmd: "noparent"
        if [ test -f  $FILE4 ]; then
        echo ""
        else
        echo > $FILE4
        msmtp -t dan.grostick at outlook.com </etc/nut/noparent.txt
        fi
;;

        fsd)
        logger -t upssched-cmd: "fsd"
        msmtp -t dan.grostick at outlook.com </etc/nut/fsd.txt
;;

        heartbeat-failure-timer)
        logger -t upssched-cmd: "heart beat fails"
         MSG1="\nNUT hearbeat fails"
        MSG2="\nCurrent status: $CHMSG $1"
        MSG3="\n$(ps -elf |grep -E 'ups[dms] |nut')"
        cat /etc/nut/heartbeatfails.txt >/tmp/message
        echo -e "$MSG1 $MSG2 $MSG3" >>/tmp/message
        cat /tmp/message >>/etc/nut/logfile
        msmtp -t dan.grostick at outlook.com </tmp/message

;;

        onbatt-timer)
        logger -t upssched-cmd:  "onbatt-timer-expired - going on battery"
        MSG1="\nUPS is now on battery"
        MSG2="\nCurrent status: $CHMSG $1"
        cat /etc/nut/onbatttimerexpired.txt >/tmp/message
        cat /tmp/message >>/etc/nut/logfile
        echo -e "$MSG1 $MSG2" >>/tmp/message
         msmtp -t  dan.grostick at outlook.com </tmp/message
;;

        nocomm-timer)
        logger -t upssched-cmd:  "nocomm-timer-expired"
        if [ test -f $FILE5 ] ; then
        echo
        else
        echo > $FILE5
        msmtp -t dan.grostick at outlook.com </etc/nut/nocommtimer.txt
        fi
;;


        *)
        logger -t upssched-cmd:  "Unknown command: $1"   
        MSG1="\nUnknown command: $1"
        cat /etc/nut/unknowncommand.txt >/tmp/message
        echo -e "$MSG1" >>/tmp/message
        cat /tmp/message >>/etc/nut/logfile
        msmtp -t </tmp/message
;;

esac
exit 0


More information about the Nut-upsuser mailing list