您好,登錄后才能下訂單哦!
# 將php-fpm設(shè)置成服務(wù),并實(shí)現(xiàn)開機(jī)自動(dòng)啟動(dòng)
# 說明:作者僅在CentOS7.0上進(jìn)行了測(cè)試,而且沒有進(jìn)行可靠性和穩(wěn)定性的測(cè)試!
vi /etc/rc.d/init.d/fpm chmod +x /etc/rc.d/init.d/fpm chkconfig --add fpm chkconfig fpm on
/etc/rc.d/init.d/fpm文件的內(nèi)容如下:
#! /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 on PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="php-fpm daemon" NAME=php-fpm INSTALLDIR=/opt/php DAEMON=$INSTALLDIR/sbin/$NAME CONFIGFILE=$INSTALLDIR/lib/$NAME.conf PIDFILE=$INSTALLDIR/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME set -e [ -x "$DAEMON" ] || exit 0 do_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 ;; esac exit 0
使用命令如下:
service fpm start service fpm stop service fpm restart service fpm test
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。