HSMensaW/telebot_watchdog
K. Lux c4caefc980 added comments to watchdog script
Signed-off-by: K. Lux <k.lux@posteo.de>
2020-02-20 19:05:34 +01:00

17 lines
467 B
Bash

#!/bin/bash
# zaehle die Prozesse, die den Bot ausfuehren
count=$(ps aux | grep HSMensaW_bot.py | grep -c -v grep)
# mehr als einer?
if [ "$count" -gt 1 ]; then
# beende alle
kill `ps axo pid,command | grep HSMensaW | grep -v grep | sed -e 's/^[[:space:]]*//' | cut -d ' ' -f1 | tr '\n' ' '`
fi
# ungleich 1 (wenn mehr, wurden sie schon beendet, daher keiner)
if [ "$count" -ne 1 ]; then
# starte neu
cd /home/pi/scripts || exit
python3 HSMensaW_bot.py &
fi