Add service restart on failure

This commit is contained in:
root
2023-03-13 07:06:50 +00:00
parent 1609c61907
commit 25bbd9a4e5
2 changed files with 1001 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ if echo "$status" | grep -qE "Active: running|Active: active"; then
echo "[$current_time] Success $(echo "$status" | grep "Main PID")" >> $LOG_FILE
else
echo "[$current_time] Failed" >> $LOG_FILE
sudo service mongod restart
fi
lines=$(wc -l < $LOG_FILE)