当前位置:网站首页>SSH自动重连脚本
SSH自动重连脚本
2022-07-31 05:11:00 【tcliuwenwen】
博文背景
实现SSH的自动重连,比如机器正在开机或者网速慢,可以自行不断尝试,直至成功连接。
具体操作
index=0;
for ((i=1;i<=10;i++));
do sshpass -p xxxxxxx ssh -o PreferredAuthentications=password -o StrictHostKeyChecking=no -o ConnectTimeout=3 [email protected] 'echo';
if [[ $? -eq 0 ]];
then
index=1;
break;
fi;
done;
if [[ "$index" -eq 1 ]];
then sshpass -p xxxxxxx ssh -o PreferredAuthentications=password -o StrictHostKeyChecking=no -o ConnectTimeout=3 [email protected];
fi
边栏推荐
- C language tutorial (2) - printf and data types that come with c
- 永恒之蓝漏洞复现
- 代码执行漏洞
- 安装Multisim出现 No software will be installed or removed解决方法
- Digital twins will be an important way to enter the "metaverse"
- GUCCI、LV等奢侈品巨头如何布局元宇宙的,其他品牌应该跟上吗?
- gin框架学习-Casbin入门指南(ACL、RBAC、域内RBAC模型)
- Year-end summary - the years are quiet~
- "limit" query in Oracle database
- 【云原生】原来2020.0.X版本开始的OpenFeign底层不再使用Ribbon了
猜你喜欢
12 【网页布局总结 元素的显示与隐藏】
leetcode-每日一题1217. 玩筹码(贪心+位运算)
[windows]--- SQL Server 2008 super detailed installation tutorial
For penetration testing methods where the output point is a timestamp (take Oracle database as an example)
【Elastic-Job源码分析】——作业监听器
阿里一面,说说你知道消息中间件的应用场景有哪些?
mysql password modification method in Linux (pro-test available)
常见JVM面试题及答案整理
动态规划(一)| 斐波那契数列和归递
leetcode-每日一题735. 行星碰撞(栈模拟)
随机推荐
The feign call fails, JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r
08 【生命周期 组件】
【ubuntu20.04安装MySQL以及MySQL-workbench可视化工具】
Error: Cannot find module ‘D:\Application\nodejs\node_modules\npm\bin\npm-cli.js‘
gin框架学习-JWT认证
leetcode-每日一题735. 行星碰撞(栈模拟)
The server time zone value ‘й‘ is unrecognized or represents more than one time zone
数字取证autopsy工具用法
03 【数据代理 事件处理】
【uiautomation】微信好友列表获取(存储到txt中)
MySQL分页查询的5种方法
5 methods of MySQL paging query
gin框架学习-Casbin入门指南(ACL、RBAC、域内RBAC模型)
2021面经-拥抱变化
[swagger close] The production environment closes the swagger method
利用phpstudy搭建DVWA
了解SSRF,这一篇就足够了
阿里一面,说说你知道消息中间件的应用场景有哪些?
代码块、Package,Import,封装(第六天)
阿里云中mysql数据库被攻击了,最终数据找回来了