MAC环境下VPN重连脚本:
on idle
tell application "System Events"
tell current location of network preferences
set myConnection to the service "VIP-TW -P"
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell
return 10
end tell
end 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 断点续传脚本:
$?=1
while [ $? -ne 0 ] ;
do repo sync ;
done