PHP-FPM boot automatically start shell script _linux Shell

Source: Internet
Author: User
Tags fpm

Online there are various versions of the PHP-FPM boot automatic script, in fact, you compiled the source directory has generated automatic script. No modification is necessary.

CP {PHP-5.3.X-SOURCE-DIR}/SAPI/FPM/INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM

PHP-FPM Boot auto start script as follows:

#! /bin/sh ### BEGIN INIT INFO # provides:php-fpm # required-start: $remote _fs $network # required-stop: $remote _fs $ Network # Default-start:2 3 4 5 # default-stop:0 1 6 # short-description:starts php-fpm # description:starts th E PHP FastCGI Process Manager daemon ### end INIT INFO prefix=/usr/local/php Exec_prefix=${prefix} php_fpm_bin=${exec_ PREFIX}/SBIN/PHP-FPM php_fpm_conf=${prefix}/etc/php-fpm.conf php_fpm_pid=${prefix}/var/run/php-fpm.pid php_opts= " --fpm-config $php _fpm_conf--pid $php _fpm_pid "Wait_for_pid () {try=0 while Test $try-lt ASE "$" in ' created ') if [-F "$"];
 
            Then try= ' break fi;; ' Removed ') if [!-f ' $ '];
        Then try= ' break fi;;
        Esac Echo-n. try= ' expr $try + 1 ' sleep 1 doing} case ' $ ' in StART) echo-n "Starting php-fpm" $php _fpm_bin--daemonize $php _opts if ["$?"!= 0]; Then echo "Failed" Exit 1 fi wait_for_pid created $php _fpm_pid if [- N "$try"];
 
    Then echo "Failed" Exit 1 else echo "done" FI;; Stop) echo-n "gracefully shutting down php-fpm" if [! -R $php _fpm_pid];
            Then echo "Warning, no PID file found-php-fpm is not running?" Exit 1 fi kill-quit ' cat $php _fpm_pid ' wait_for_pid removed $php _fpm_pid if [-N ' $ Try "]; Then echo "failed.
 
    Use Force-quit ' exit 1 else echo ' done ' fi;; Force-quit) echo-n "terminating php-fpm" if [! -R $php _fpm_pid];
            Then echo "Warning, no PID file found-php-fpm is not running?"
       Exit 1 Fi kill-term ' cat $php _fpm_pid ' wait_for_pid removed $php _fpm_pid if [-N "$try"];
 
    Then echo "Failed" Exit 1 else echo "done" FI;;
 
    Restart) $ stop $ start;; Reload) echo-n "Reload service php-fpm" if [! -R $php _fpm_pid];
            Then echo "Warning, no PID file found-php-fpm is not running?"
 
    Exit 1 fi kill-usr2 ' cat $php _fpm_pid ' echo "done";;
 
*) echo "Usage: $ {start|stop|force-quit|restart|reload}" exit 1;;
 Esac

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.