bash脚本,如何检查条件是否为真,应该检查下5次或接下来的50秒相同的条件,它为真,警报

问题描述 投票:0回答:1
#! /bin/bash 
requestCount=( grep "stingTofind request in nginx total request in one minutes)

if [ $requestCount -gt 10 ]; then 

 ##here I am trying to check if conditation is true for next 2 minutes on every 30 second interval##

fi

不确定我该如何实现..谁能帮我吗?

谢谢,

bash
1个回答
0
投票

写一个函数进行检查。然后循环调用该函数。如果结果正常,请退出脚本。如果结果不正确,请睡眠30秒钟。在四次睡眠30秒后,对此发出警报。

© www.soinside.com 2019 - 2024. All rights reserved.