1 Star 0 Fork 3

bryan/adsb-scripts

forked from 小孟/adsb-scripts 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
pingfail.sh 740 Bytes
一键复制 编辑 原始数据 按行查看 历史
Matthias Wirth 提交于 2020-11-22 12:42 . renice for readsb-install
#!/bin/bash
trap "exit" INT TERM
trap "kill 0" EXIT
TEST1="google.com"
TEST2="akamai.com"
FAIL="no"
while sleep 300
do
if ping $TEST1 -c1 -w5 >/dev/null || ping $TEST2 -c1 -w5 >/dev/null
then
FAIL="no"
elif [[ "$FAIL" == yes ]]
then
if ! ping $TEST1 -c5 -w20 >/dev/null && ! ping $TEST2 -c5 -w20 >/dev/null
then
echo "$(date): Rebooting, could reach neither $TEST1 nor $TEST2" | tee -a /var/log/pingfail
mkdir -p /run/systemd/system/reboot.target.d/
cat > /run/systemd/system/reboot.target.d/fastreboot.conf <<"EOF"
[Unit]
JobTimeoutSec=60
JobTimeoutAction=reboot-force
EOF
systemctl daemon-reload
sync
reboot
fi
FAIL="no"
else
FAIL="yes"
fi
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bryan007/adsb-scripts.git
git@gitee.com:bryan007/adsb-scripts.git
bryan007
adsb-scripts
adsb-scripts
master

搜索帮助