added comments to watchdog script
Signed-off-by: K. Lux <k.lux@posteo.de>
This commit is contained in:
parent
79176eb1b0
commit
c4caefc980
1 changed files with 7 additions and 1 deletions
|
@ -1,9 +1,15 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# zaehle die Prozesse, die den Bot ausfuehren
|
||||||
count=$(ps aux | grep HSMensaW_bot.py | grep -c -v grep)
|
count=$(ps aux | grep HSMensaW_bot.py | grep -c -v grep)
|
||||||
|
# mehr als einer?
|
||||||
if [ "$count" -gt 1 ]; then
|
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' ' '`
|
kill `ps axo pid,command | grep HSMensaW | grep -v grep | sed -e 's/^[[:space:]]*//' | cut -d ' ' -f1 | tr '\n' ' '`
|
||||||
fi
|
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
|
cd /home/pi/scripts || exit
|
||||||
python3 HSMensaW_bot.py &
|
python3 HSMensaW_bot.py &
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue