Chinaunix首页 | 论坛 | 博客
  • 博客访问: 109954
  • 博文数量: 25
  • 博客积分: 1094
  • 博客等级: 少尉
  • 技术积分: 284
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-25 16:36
文章分类

全部博文(25)

文章存档

2011年(14)

2010年(11)

分类: LINUX

2010-03-09 16:18:10

#! /bin/bash
id=`curl -I --connect-timeout 20 |awk '{ print $2;exit}'`
status=no
while [ true ]
do
sleep 10
if [ "${id}" != 200 ] && [ "$status" = ok ] ; then
        echo '什么事都不做'
       sleep 5
     elif [ "${id}" != 200 ]; then
        echo '发邮件通知'
        echo '重启'
        sleep 5
             status=ok
      elif [ "${id}" = 200 ] && [ "$status" = ok ]; then
        echo '发邮件通知'
         sleep 5
              status=no
      elif [ "${id}" = 200 ]; then
        echo '正常'
fi
id=`curl -I --connect-timeout 20 |awk '{ print $2;exit}'`
阅读(1441) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-03-11 10:50:24

curl -I --connect-timeout 20 http://www.qq.com|awk '{ print $2;exit}' 你这个取值 有问题哦!