added "watchdog" script

Signed-off-by: K. Lux <k.lux@posteo.de>
This commit is contained in:
K. Lux 2020-02-20 18:52:56 +01:00
parent 7a16104c96
commit 79176eb1b0
1 changed files with 10 additions and 0 deletions

10
telebot_watchdog Normal file
View File

@ -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