shell脚本中执行一个命令,在等待15秒后,没有这个命令的结果,就执行下一条

#!/bin/bash
 
func()
{
     wget ...
     touch  finished
}
 
func &
sleep  3000
if  [ -f finished ]
then
     echo  "finished"
else
     echo  "not finished"
fi
rm  -f finished

touch命令有两个功能:一是用于把已存在文件的时间标签更新为系统当前的时间(默认方式),它们的数据将原封不动地保留下来;
二是用来创建新的空文件

#!/bin/bash 
cd /home/oracle/monitor
func()
{
  /u02/BIEE12C/user_projects/domains/bi/bitools/bin/datamodel.sh listconnectionpool -SI ssi -U Administrator -P Admin123|grep "Spark BIEE"
  if [ $? -eq 0 ]; then
 
touch obis1return
  echo "obis1return>>>>>>>>>>"
  fi
}


func &
sleep 15


if [ ! -f obis1return ]; then
echo `date '+%Y-%m-%d %H:%M:%S'`"BIEE obis1 is stucked"
rm -f obis1return
else
echo `date '+%Y-%m-%d %H:%M:%S'`"BIEE obis1 is normal"

rm -f obis1return
fi
  • 4
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值