ret = system("timeout 5 rabbitmqctl status");
//last -x | grep shutdown | head -1
timeout()
{
waitfor=3
command=$*
$command &
commandpid=$!
( sleep $waitfor ; kill -9 $commandpid >/dev/null2>&1)&
watchdog=$!
sleeppid=$PPID
wait $commandpid >/dev/null2>&1
kill $sleeppid >/dev/null2>&1
————————————————
版权声明:本文为CSDN博主「向良玉」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/xiangliangyu/java/article/details/82585851
阅读(496) | 评论(0) | 转发(0) |