1.编写脚本
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
vim nginx_pid.sh#!/bin/bashwhile :donginxpid=`ps -C nginx --no-header | wc -l`if [ $nginxpid -eq 0 ];then/usr/local/nginx/sbin/nginxsleep 5 if [ $nginxpid -eq 0 ];then /etc/init.d/keepalived stop fifisleep 5done |