#!/bin/bash if [[ `curl -sS --connect-timeout 15 -m 15 127.0.0.1/phpfpm_56_status|grep 502` == *"502"* ]]; then /etc/init.d/php-fpm-56 stop /etc/init.d/php-fpm-56 start else echo php56 normal. fi