User Tools

Site Tools


check_service_and_restart_if_failed

This is an old revision of the document!


Check service and restart if failed

Check the service if nginx is running and if not start

#!/usr/bin/env bash
 
STATUS="$(systemctl is-active nginx.service)"
 
if [ "${STATUS}" != "active" ]; then
   systemctl start nginx.service
fi
check_service_and_restart_if_failed.1595812614.txt.gz · Last modified: 2020/08/10 02:30 (external edit)