#!/bin/bash# Stop PHP-Fpmsudo PHP-VPS-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} process is shutting down ....."sudo kill-INT $pidElseEcho"failed to close php-fpm, the service did not start ...."fi# Stop Nginxif[-f/home/nginx/conf/nginx.pid]then #sudo nginx-s Stop PID= ' cat/home/nginx/conf/Nginx.pid ' echo"Nginx Id:${pid} process is shutting down ..."sudo kill-INT $pidElseEcho"Nginx shutdown failed, the service has not started ..."fi
Start the service:
#!/bin/bash# starting PHP-Fpmsudo PHP-VPS-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} process has started ....."Elsesudo php-FPM Echo"start the PHP-FPM process ... ..... ....."fi# start Nginxif[-f/home/nginx/conf/nginx.pid]then #sudo nginx-s Stop PID= ' cat/home/nginx/conf/Nginx.pid ' echo"Nginx Id:${pid} process has started ..."Elsesudo nginx echo"start the Nginx process ... ...... ....."fi}showpro# run Showpro again
Enable and disable scripts for Nginx and PHP-FPM