#!/bin/bash # Check that the MQTT subscriber (mosquitto_sub) and the main push loop (sleep 30) # are both running. The subscriber handles incoming commands from Home Assistant, # the sleep 30 indicates the push loop is actively cycling. SUBSCRIBER=`ps ax | grep "mosquitto_sub" | grep -v grep | wc -l` LOOP=`ps ax | grep "sleep 30" | grep -v grep | wc -l` if [ "$SUBSCRIBER" -ge "1" ] && [ "$LOOP" -ge "1" ] ; then exit 0 else exit 99 fi