HSMensaW/telebot_watchdog

11 lines
306 B
Bash

#!/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