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 +