shell脚本超时watchdog
来源:互联网 发布:库存整理软件 编辑:程序博客网 时间:2024/06/05 12:01
脚本中的命令正常结束,干掉watchdog,否则watchdog干掉超时进程。
#!/bin/sh
timeout()
{
waitfor=5
command=$*
$command &
commandpid=$!
(sleep $waitfor;kill -9 $commandpid >/dev/null 2>&1) &
watchdogpid=$!
sleeppid=`ps $ppid $watchdogpid | awk '{print $1}'`
wait $commandpid
kill $sleeppid >/dev/null 2>&1
}
timeout sleep 7
echo "hi, boy!"
上述程序输出如下:
# ./test_watchdog.sh
./test_watchdog.sh: line 14: 1970 Killed $command
hi, boy!
#
0 0
- shell脚本超时watchdog
- shell脚本超时控制
- shell脚本超时控制
- shell脚本超时控制
- SHELL脚本-OMC超时补报
- Java执行Shell脚本超时控制
- linux shell 脚本/命令 超时 结束
- Linux Watchdog 脚本
- 防止shell脚本长时间运行导致ssh超时
- watchdog
- WatchDog
- Watchdog
- watchdog
- WatchDog
- watchdog
- Watchdog
- Watchdog
- Watchdog
- 关于如何解决当type=number时,加减箭头的处理;
- JavaScript知识点总结---------003(变量类型)
- 平行世界产品分析|冷暖自知的世界
- 深度学习11:MatConvNet的cifar介绍
- OpenMp使用例子
- shell脚本超时watchdog
- BZOJ 4782 Usaco2017 Open Bovine Genomics
- LVS:四种负载均衡方式比较
- 错误票据
- 洛谷 P 1273 有线电视网
- Andorid 坑 Fragment重叠问题分析和解决
- OJ 刷题 5-3 出租 (20)
- 关于C#的sqlite数据库操作类
- spring和springmvc的父子容器的关系