您好,登錄后才能下訂單哦!
# 將php-fpm設置成服務,并實現開機自動啟動
# 說明:作者僅在CentOS7.0上進行了測試,而且沒有進行可靠性和穩定性的測試!
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文件的內容如下:
#! /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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。