程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 更多關於編程 >> php-fpm開機自動啟動Shell腳本

php-fpm開機自動啟動Shell腳本

編輯:更多關於編程

       這篇文章主要介紹了php-fpm開機自動啟動Shell腳本,本文腳本只是范例,其實你編譯安裝完成後,啟動腳本已經生成在編譯目錄中,只需要復制出來用就可以了,需要的朋友可以參考下

      網上有各種版本的php-fpm開機自動啟動腳本, 其實你編譯後源目錄已經生成自動腳本。不用做任何修改即用。

      ?

    1 cp {php-5.3.x-source-dir}/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

      php-fpm開機自動啟動腳本如下:

      ?

    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 43 44 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 84 85 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 119 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_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 35 ; do   case "$1" in 'created') if [ -f "$2" ] ; then try='' break fi ;;   'removed') if [ ! -f "$2" ] ; then try='' break fi ;; esac   echo -n . try=`expr $try + 1` sleep 1   done   }   case "$1" 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) $0 stop $0 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: $0 {start|stop|force-quit|restart|reload}" exit 1 ;;   esac
    1. 上一頁:
    2. 下一頁:
    Copyright © 程式師世界 All Rights Reserved