1. 程式人生 > >shell監控php是否掛了502 ,並重啟php

shell監控php是否掛了502 ,並重啟php

    #!/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

原文:https://www.1bug.com/?p=1405