From 79176eb1b064ba039769d0db026fec44c297a81f Mon Sep 17 00:00:00 2001 From: "K. Lux" Date: Thu, 20 Feb 2020 18:52:56 +0100 Subject: [PATCH] added "watchdog" script Signed-off-by: K. Lux --- telebot_watchdog | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 telebot_watchdog diff --git a/telebot_watchdog b/telebot_watchdog new file mode 100644 index 0000000..d640c01 --- /dev/null +++ b/telebot_watchdog @@ -0,0 +1,10 @@ +#!/bin/bash +count=$(ps aux | grep HSMensaW_bot.py | grep -c -v grep) +if [ "$count" -gt 1 ]; then + 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 + cd /home/pi/scripts || exit + python3 HSMensaW_bot.py & +fi +