Check_Nginx_Server
#!/bin/bash
NginxServer='api.majiameng.com'
time1=$(date "+%Y-%m-%d %H:%M:%S")
heck_Nginx_Server()
http_status_code=$(curl -m 5 -s -i -w %{http_code} -o/home/index.html $NginxServer)
if [ $http_status_code -eq 000 -o $http_status_code -ge 500 ];then
echo -e $time1"check http server error ,code is" $http_status_code
systemctl restart nscd
nginx -t
nginx -s reload
echo -e "nginx reload success"
else
http_content=$(curl -s ${NginxServer})
#echo "service status ok \n "$http_content
#echo -e $time1"service status ok ,code:"$http_status_code
fi
}
One comment
用来干什么的呢