Skip to content

Instantly share code, notes, and snippets.

@xuzh0u
Created June 4, 2022 12:35
Show Gist options
  • Save xuzh0u/b3e81cb0f9041807dd6ee8ac5d13676c to your computer and use it in GitHub Desktop.
Save xuzh0u/b3e81cb0f9041807dd6ee8ac5d13676c to your computer and use it in GitHub Desktop.
如何在Linux系统尽可能保证UCAS校园网不断连?
#!/bin/bash
while true
do
loss_rate=$(ping www.baidu.com -c 4 | grep "packet loss" | awk -F, {'print$3'} | cut -d' ' -f2)
if [ "$loss_rate" != "0%" ]
then
nmcli conn up UCAS
# PUT YOUR CURL COMMAND HERE 去用浏览器开发者工具的 network 面板找到提交表单的请求,copy as CURL 然后粘贴到这里
fi
sleep 10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment