Script to check if something else is running.
This is a simple script to check that something else is still running and if not start it up again.
[bash]
#!/bin/sh
SERVICE=’mqtt3′
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo "$SERVICE service running, everything is fine"
else
echo "$SERVICE is not running"
# echo "$SERVICE is not running!" | mail -s "$SERVICE down" root
nohup /usr/bin/python3 /home/pi/bin/mqtt3.py &
fi
[/bash]