From c4caefc980b26ef5fb7662d2cf5a49ee5398430e Mon Sep 17 00:00:00 2001 From: "K. Lux" Date: Thu, 20 Feb 2020 19:04:31 +0100 Subject: [PATCH] added comments to watchdog script Signed-off-by: K. Lux --- telebot_watchdog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/telebot_watchdog b/telebot_watchdog index d640c01..a279335 100644 --- a/telebot_watchdog +++ b/telebot_watchdog @@ -1,9 +1,15 @@ #!/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 -if [ "$count" -lt 1 ]; then + +# 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