PHP-FPM Service (php7)

Source: Internet
Author: User

#! /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 The PHP FastCGI Process Manager daemon### END INIT infoprefix=/usr/local/Php7exec_prefix=${prefix}php_fpm_bin=${exec_prefix}/sbin/php-fpmphp_fpm_conf=${prefix}/etc/php-fpm.conf# php_fpm_conf=/mnt/opt/1_config/etc/php-fpm/php-Fpm.confphp_fpm_pid=${prefix}/var/run/php-fpm.pidphp_opts="--fpm-config $php _fpm_conf--pid $php _fpm_pid"wait_for_pid () {try=0     whileTest $TRY-LT *; do         case " $" inch            'created')            if[-f" $"] ; thenTry="' breakfi            ;; 'removed')            if[!-f" $"] ; thenTry="' breakfi            ;; Esac        Echo-N. Try=`Expr$try +1`        Sleep 1     done} case " $" inchstart)Echo-n"starting PHP-FPM"$php _fpm_bin--daemonize $php _optsif["$?"!=0] ; then            Echo "failed"Exit1        fiWait_for_pid created $php _fpm_pidif[-n"$try"] ; then            Echo "failed"Exit1        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?"Exit1        fi        Kill-quit 'Cat$php _fpm_pid ' wait_for_pid removed $php _fpm_pidif[-n"$try"] ; then            Echo "Failed. Use Force-quit"Exit1        Else            Echo " done"        fi    ;; Status)if[!-r $php _fpm_pid]; then            Echo "PHP-FPM is stopped"Exit0        fiPID=`Cat$php _fpm_pid 'if PS-p $PID |grep-q $PID; then            Echo "php-fpm (pid $PID) is running ..."        Else            Echo "php-fpm dead But PID file exists"        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?"Exit1        fi        Kill-term 'Cat$php _fpm_pid ' wait_for_pid removed $php _fpm_pidif[-n"$try"] ; then            Echo "failed"Exit1        Else            Echo " done"        fi    ;; Restart) $0Stop $0start;; Reload)Echo-n"Reload Service PHP-FPM"        if[!-r $php _fpm_pid]; then            Echo "warning, No PID file found-php-fpm is not running?"Exit1        fi        Kill-USR2 'Cat$php _fpm_pid 'Echo " done"    ;; Configtest) $php _fpm_bin-t;; *)        Echo "Usage: $ {start|stop|force-quit|restart|reload|status|configtest}"Exit1    ;;Esac

PHP-FPM Service (php7)

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.