Nginx和php-fpm的啟用和停用腳本
阿新 • • 發佈:2018-04-06
OS show pid clas bash nbsp style col 停止
#!/bin/bash #停止php-fpm sudo php -v ps -ef | grep php-fpm | sed ‘$d‘ echo "..............................." ps -ef | grep nginx | sed ‘$d‘ echo ".............................." if [ -f /home/php/var/run/php-fpm.pid ] then pid=`cat /home/php/var/run/php-fpm.pid` echo "PHP-FPM ID:${pid}進程正在關閉....." sudo kill-INT $pid else echo "關閉PHP-FPM失敗;該服務沒有啟動...." fi #停止nginx if [ -f /home/nginx/conf/nginx.pid ] then #sudo nginx -s stop pid=`cat /home/nginx/conf/nginx.pid` echo "Nginx ID:${pid}進程正在關閉......" sudo kill -INT $pid else echo "Nginx關閉失敗;該服務還未啟動......" fi
啟動服務:
#!/bin/bash #啟動php-fpm sudo php-v ps -ef | grep php-fpm | sed ‘$d‘ echo "..............................." ps -ef | grep nginx | sed ‘$d‘ echo ".............................." #啟動進程 showpro(){ if [ -f /home/php/var/run/php-fpm.pid ] then pid=`cat /home/php/var/run/php-fpm.pid` echo "PHP-FPM ID:${pid}進程已經啟動....." else sudo php-fpm echo"啟動PHP-FPM進程..................." fi #啟動nginx if [ -f /home/nginx/conf/nginx.pid ] then #sudo nginx -s stop pid=`cat /home/nginx/conf/nginx.pid` echo "Nginx ID:${pid}進程已經啟動......" else sudo nginx echo "啟動Nginx進程....................." fi } showpro #再次執行運行 showpro
Nginx和php-fpm的啟用和停用腳本