php-fpm的CentOS開機自啟指令碼

來源:互聯網
上載者:User

標籤:php-fpm

# 將php-fpm設定成服務,並實現開機自動啟動

# 說明:作者僅在CentOS7.0上進行了測試,而且沒有進行可靠性和穩定性的測試!

vi /etc/rc.d/init.d/fpmchmod +x /etc/rc.d/init.d/fpmchkconfig --add fpmchkconfig fpm on


/etc/rc.d/init.d/fpm檔案的內容如下:

#! /bin/sh#chkconfig: 2345 60 90## vi /opt/php/etc/php-fpm.conf  #uncomment pid under [global]  #pid = run/php-fpm.pid## vi /etc/rc.d/init.d/fpm## chmod +x /etc/rc.d/init.d/fpm## chkconfig --add fpm## chkconfig fpm onPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/binDESC="php-fpm daemon"NAME=php-fpmINSTALLDIR=/opt/phpDAEMON=$INSTALLDIR/sbin/$NAMECONFIGFILE=$INSTALLDIR/lib/$NAME.confPIDFILE=$INSTALLDIR/var/run/$NAME.pidSCRIPTNAME=/etc/init.d/$NAMEset -e[ -x "$DAEMON" ] || exit 0do_start() {    $DAEMON -D || echo -n "php-fpm already running"}do_stop() {    kill -INT `cat $PIDFILE` || echo -n "php-fpm not running"}do_test() {    $DAEMON -t || echo -n "php-fpm can‘t test"}case "$1" in    start)        echo -n "Starting $DESC: $NAME"        do_start        echo "."    ;;    stop)        echo -n "Stopping $DESC: $NAME"        do_stop        echo "."    ;;    restart)        echo -n "Restarting $DESC: $NAME"        do_stop        do_start        echo "."    ;;    test)        echo -n "Testing $DESC: $NAME"        do_test        echo "."    ;;    *)    echo "Usage: $SCRIPTNAME {start|stop|restart|test}" >&2    exit 3    ;;esacexit 0


使用命令如下:

service fpm startservice fpm stopservice fpm restartservice fpm test




本文出自 “◆峰迴路轉◇2015啟程◆” 部落格,請務必保留此出處http://huangfuff.blog.51cto.com/2632203/1612655

php-fpm的CentOS開機自啟指令碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.