shell监控php是否挂了502 ,并重启php

阅读 74

2023-02-15


#!/bin/bash

CheckURL="http://xx"

STATUS_CODE=`curl -o /dev/null -m 10 –connect-timeout 10 -s -w %{http_code} $CheckURL`

#echo "$CheckURL Status Code:\t$STATUS_CODE"

if [ "$STATUS_CODE" = "502" ]; then

lnmp php-fpm restart

fi

保存:

​​502.sh​​

* * * * * sh /www/sh/502.sh >> /www/log/crontab.log 2>1


精彩评论(0)

0 0 举报