Tag: phpfpm restart PHP script
#!/bin/bashpid= "/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 ];thenecho "Pid exists" fiif [ -f /opt/php7/etc/php.ini ];thenecho "Ini file exists" FIIF [ -F /OPT/PHP7 /etc/php-fpm.conf ];thenecho "Php-fpm configure file exists" fiecho $1case $ 1 instart) 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" &Nbsp; 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:
Save As Shell script file, run directly, will prompt the use of methods, according to the installation environment, modify the PID INI conf and other file paths.
This article is from the "Thousand Face" blog, please make sure to keep this source http://oslibo.blog.51cto.com/10854638/1913101
Compile and install php-fpm restart script