2 Star 1 Fork 0

陈孝松/blog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
monitor-ssh.sh 395 Bytes
一键复制 编辑 原始数据 按行查看 历史
ChenXiaoSong 提交于 2024-07-12 22:16 +08:00 . add src/ssh-reverse/
# 在 root 下执行 ssh-copy-id -p 55555 chenxiaosong.com
# 在 root 下执行本脚本 bash monitor-ssh.sh
log_path=/tmp
while true
do
ssh -p 55555 -o ConnectTimeout=2 -q sonvhi@hz.chenxiaosong.com exit
if [ $? != 0 ]
then
echo `date` > ${log_path}/ssh-monitor-fail.log
systemctl restart ssh-reverse.service
else
echo `date` > ${log_path}/ssh-monitor-success.log
fi
sleep 30
done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chenxiaosonggitee/blog.git
git@gitee.com:chenxiaosonggitee/blog.git
chenxiaosonggitee
blog
blog
master

搜索帮助