MAC环境下VPN重连脚本:
on idletell application "System Events"tell current location of network preferencesset myConnection to the service "VIP-TW -P"if myConnection is not null thenif current configuration of myConnection is not connected thenconnect myConnectionend ifend ifend tellreturn 10end tellend idle
Linux环境下VPN重连脚本:
#!/bin/bash connect="5"while [ "true" ] do VPNCON=$(nmcli con show uuid 117fcee0-d5b5-4964-9025-bef5efe9053f | grep VPN.VPN-STATE | awk '{print $2}') echo $VPNCON if [ "$VPNCON" != "$connect" ];then echo "Disconnected, trying to reconnect..." (sleep 1s && nmcli con up uuid 117fcee0-d5b5-4964-9025-bef5efe9053f) else echo "Already connected !" fi sleep 5 done
repo 断点续传脚本:
$?=1while [ $? -ne 0 ] ;do repo sync ;done