#!/bin/sh # VA1DER - apprentice.va1der.net check to make sure Syncthing is still running # This needs OpenWRT packages 'procps-ng-ps' and 'logger' to function # Count the number of entries in the process list taken by syncthing STNUM=$(/bin/ps auxwww | grep -v grep | grep syncthing | wc -l) # If there are less than two entries it means something's wrong, restart if [ 0$STNUM -lt 2 ]; then logger -t stcheck -p cron.info "syncthing not detected - restarting" killall -q syncthing sleep 2 /root/bin/ststart fi # end.