1. 首页
  2. 数据库
  3. 其它
  4. 一个shell for循环与case结合的脚本(监控程序状态)

一个shell for循环与case结合的脚本(监控程序状态)

上传者: 2021-01-16 12:18:18上传 PDF文件 26.4KB 热度 17次
核心代码: 代码如下:#/bin/bashset -xHOSTS=”nginx mysql php-cgi”for myhost in $HOSTS do count=(`ps aux |grep $myhost |grep -v grep |wc -l`) echo “$myhost” echo “$count” if [ $count -eq 0 ]; then case $myhost in nginx) cd /usr/local/webserver/nginx/sbin/ ./nginx echo “nginx has be down” sleep 5 my
下载地址
用户评论