详细教程
创建一个文件, auto-renew.sh, 内容如下
#!/bin/bash
while true; do
sshpass -p '密码' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -tt 用户名@地址 "exit" &
sleep 259200 #30天为259200秒
done
给 auto-renew.sh添加可执行权限:
chmod +x auto-renew.sh
使用pm2启动:
pm2 start ./auto-renew.sh
这样就会每隔一个月自动执行一次SSH连接,自己SSH自己进行续期。
没有评论:
发表评论