V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
andybest
V2EX  ›  问与答

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

  •  
  •   andybest · Jun 6, 2013 · 4507 views
    This topic created in 4719 days ago, the information mentioned may be changed or developed.
    每分钟执行:
    curl http://127.0.0.1/monitor
    假设如果response code为503,则运行/bin/dump.sh

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

    感谢!
    1 replies    1970-01-01 08:00:00 +08:00
    SuperOS
        1
    SuperOS  
       Jun 6, 2013   ❤️ 1
    curl --head http://www.baidu.com/ 2>&1|grep "HTTP/"
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5471 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 07:03 · PVG 15:03 · LAX 00:03 · JFK 03:03
    ♥ Do have faith in what you're doing.