PHP-FPM start the shell script automatically

Source: Internet
Author: User
Tags exit fpm

This article mainly introduces the PHP-FPM boot automatic shell script, this article script is just an example, in fact, you compile the installation completed, the startup script has been generated in the compilation directory, only need to copy out to use on it, need friends can refer to the

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.

?

1 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:

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26-27--28 29---30 31--32 33 34 35 36 37 38-39 40 41 42 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 5, 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 11 9 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134-135 #! /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 INFO   prefix=/usr/local/php Exec_prefix=${prefix}   Php_fpm_bin=${exec_pre FIX}/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. Do &nb Sp Case "$" in ' created ') if [-F "$"]; Then try= ' break fi;;   ' removed ') if [!-f ' $ ']; Then try= ' break fi;; Esac   Echo-n. try= ' expr $try + 1 ' sleep 1   do  }   case ' "in Start" echo-n "Starting php-fpm"   $php _fpm_bi N--daemonize $php _opts   If ["$?"!= 0]; Then echo "Failed" Exit 1 fi   Wait_for_pid created $php _fpm_pid &nbSp 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 '   WA It_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 '   WA It_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 '   EC Ho "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.