#!/bin/sh
sed -i '22c #server {' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '23c # listen 3307;' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '24c # proxy_connect_timeout 1s;' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '25c # proxy_timeout 3s;' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '26c # proxy_pass 10.0.0.33:3307;' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '27c #}' /usr/local/webserver/nginx/conf/nginx.conf
NAME=nginx
echo $NAME
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
echo $ID
echo "---------------"
for id in $ID
do
kill -9 $id
echo "killed $id"
done
echo "---------------"
/usr/local/webserver/nginx/sbin/nginx
echo "mysql公网关闭成功"
版本 二
#!/bin/sh
echo -e "\E[1;33m"
cat <<\EOF
/\
/\ //\\
/\ //\\///\\\ /\
/^ \ / ^\/ ^ ^ ^ / ^ ^ ^ \/ ^ ^ \ *
/ ^ ^ \/^ ^\ ^ ^ ^ ^ ^ ^ ____ ^ ^ \ /|\
/ ^ ^ ^ \ ^ _\___________________| |_____^ ^ \ /||o\
/ ^^ ^ ^ ^\ /______________________________\ ^ ^ \ /|o|||\
/ ^ ^^ ^ ^ /________________________________\ ^ /|||||o|\
/ ^ ^ ^ ^ ^ ^ ||||||||||||||||||||||||||||||oooooooooo| |ooooooo |
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
__ _ _ _
__ __ __ __ _ _ _ / _` | _ __ _ _ | |_ (_) __ _ _ _
\ V V // _` | | ' \ \__, | | ' \ | +| | | _| | | / _` | | ' \
\_/\_/ \__,_| |_||_| |___/ |_|_|_| \_,_| _\__| _|_|_ \__,_| |_||_|
EOF
echo -e "\E[0m"
echo "高山仰止,景行行止.虽不能至,心向往之。"
sleep 1s
#显示绿色
#showGreen CONTENT
#CONTENT:显示的内容
showGreen()
{
content=$1
echo -e "\033[1;32m$content\033[0m"
}
#添加mysql配置
sed -i '22c
sed -i '23c # listen 3307;' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '24c # proxy_connect_timeout 1s;' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '25c # proxy_timeout 3s;' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '26c # proxy_pass 10.0.0.33:3307;' /usr/local/webserver/nginx/conf/nginx.conf
sed -i '27c #}' /usr/local/webserver/nginx/conf/nginx.conf
NAME=nginx
echo $NAME
ID=`ps -ef | grep "$NAME" | grep -v "$0" | grep -v "grep" | awk '{print $2}'`
`ps -ef | grep "$NAME"`
echo -e "\E[1;32mok\E[0m ................................. \E[1;36m[已查询出全部进程]\E[0m"
sleep 1s
for id in $ID
do
kill -9 $id
sleep 1s
echo -e "\E[1;32mok\E[0m ................................. \E[1;36m[已kill $id 进程]\E[0m"
done
sleep 1s
/usr/local/webserver/nginx/sbin/nginx
echo -e "\E[1;32mok\E[0m ................................. \E[1;36m[mysql公网已关闭]\E[0m"
