Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我在 Hack The Box 上,有时 VPN 在离开或执行一些可能会干扰连接的其他任务后实际上并没有连接到主机。我只需要帮助制作一个 bash 脚本。
这应该你开始:
#!/bin/bash ip=... interval=30 function restart_vpn() { ... } while : do ping -c $ip > /dev/null || restart_vpn sleep $interval done
不确定“Hack The Box”是什么,但您可能能够以比通过 ping 更直接的方式确定您的 vpn 状态。例如,在 Linux 上,您可能会获得一个界面,您可以使用ip link.
ip link