您好,登錄后才能下訂單哦!
#!/bin/bash pid="/opt/php7/var/run/php-fpm.pid" ini="/opt/php7/etc/php.ini" conf="/opt/php7/etc/php-fpm.conf" if [ -f /opt/php7/var/run/php-fpm.pid ];then echo "pid exists" fi if [ -f /opt/php7/etc/php.ini ];then echo "ini file exists" fi if [ -f /opt/php7/etc/php-fpm.conf ];then echo "php-fpm configure file exists" fi echo $1 case $1 in start) if [ -f $pid ];then echo "Process already exists." else /opt/php7/sbin/php-fpm -c $ini -y $conf if (( $?==0 ));then echo "Start php-fpm success" else echo "Start faild......" fi fi ;; stop) if [ -f $pid ];then echo "Stop php-fpm process" kill $(cat $pid) if (( $?==0 ));then echo "Stop php-fpm over." else echo "Stop php-fpm faild..." fi else echo "Check process exists?" fi ;; restart) if [ -f $pid ];then kill $(cat $pid) if (( $?==0 ));then echo "Stop php-fpm over" /opt/php7/sbin/php-fpm -c $ini -y $conf if (( $?==0 ));then echo "Start php-fpm over" else echo "Start faild" fi else echo "Stop faild" fi else /opt/php7/sbin/php-fpm -c $ini -y $conf if (( $?==0 ));then echo "Start php-fpm over" else echo "Star faild" fi fi ;; *) echo "Usage: php.sh (start|stop|restart)" esac
readme:
保存為shell腳本文件,直接運(yùn)行,會(huì)提示使用方法,根據(jù)安裝環(huán)境,修改pid ini conf 等文件路徑。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。