V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
andybest
V2EX  ›  问与答

[Linux-shell] 每分钟一次访问页面,如果返回代码xxx则执行脚本xxx.sh,怎么实现最酷最好?

  •  
  •   andybest · 2013-06-06 18:31:38 +08:00 · 4082 次点击
    这是一个创建于 4034 天前的主题,其中的信息可能已经有所发展或是发生改变。
    每分钟执行:
    curl http://127.0.0.1/monitor
    假设如果response code为503,则运行/bin/dump.sh

    如果是shell脚本实现,这个脚本怎么写?

    感谢!
    1 条回复    1970-01-01 08:00:00 +08:00
    SuperOS
        1
    SuperOS  
       2013-06-06 19:22:41 +08:00   ❤️ 1
    curl --head http://www.baidu.com/ 2>&1|grep "HTTP/"
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2440 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 03:23 · PVG 11:23 · LAX 20:23 · JFK 23:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.