Php-fpm is prone to false positives, and shell automatically restarts the php service.

Source: Internet
Author: User
It runs continuously through the background, and restarts if any problem is detected. There are few script codes, the statements are very simple, and the consumption of system resources is very low. You can try it. It seems stupid, but it is effective ~ #! /Bin/bash # checkphp-fpmserverup/downTelLog =/tmp/telphp. logwhile: dosleep15;/usr/bin/telnet127.0.0.19000 & lt; & l

It runs continuously through the background, and restarts if any problem is detected. There are few script codes, the statements are very simple, and the consumption of system resources is very low. You can try it.
It seems stupid, but it is effective ~
#! /Bin/bash
# Check php-fpm server up/down
TelLog =/tmp/telphp. log
While:
Do
Sleep 15;
/Usr/bin/telnet 127.0.0.1 9000 <! > $ TelLog
Quit
!
SOK = 'cat $ TelLog | grep "Escape character" | wc-l'
If [$ SOK-eq 1]; then
Echo "php-fpm is OK"
Else
/Usr/local/webserver/php/sbin/php-fpm restart
Fi
Done

Run
Nohup/bin/sh/usr/local/shell/php_chcek.sh>/dev/null 2> & 1 &

Share happiness ~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.