#! /bin/bash
nginx(){
systemctl status nginx
#if [ `systemctl status nginx | grep 'running'` -eq "running" ];then
for i in `systemctl status nginx`
do
if [ $i == "active" ];then
echo "nginx is running"
fi
if [ $i == "inactive" ];then
echo "nginx is dead"
systemctl start nginx
fi
done
}
nginx