2,Nginx + PHP + MySQL简易管理Shell脚本
nginx
========================================================================
#!/bin/bash
function_start_nginx(){
printf "Starting Nginx ...\n"
ulimit -SHn 51200
/usr/local/nginx/sbin/nginx 2>&1 > /dev/null &
}
function_stop_nginx(){
printf "Stoping Nginx ...\n"
ps -ef | grep "nginx:" | grep -v grep | awk '{print "kill -9 " $2}' | /bin/sh
}
function_reload_nginx(){
printf "Reloading Nginx ...\n"
ps -ef | grep "nginx: master proccess" | grep -v grep | awk '{print "kill -HUP " $2}' | /bin/sh
}
function_restart_nginx(){
printf "Restarting Nginx ...\n"
function_stop_nginx
sleep 3
function_start_nginx
}
if [ "$1" = "start" ]; then
function_start_nginx
elif [ "$1" = "stop" ]; then
function_stop_nginx
elif [ "$1" = "reload" ]; then
function_reload_nginx
elif [ "$1" = "restart" ]; then
function_restart_nginx
else
printf "Usage: nginx {start|stop|reload|restart} \n"
fi
