Last active
May 7, 2021 09:17
-
-
Save CheyiLin/0beb9a42ab1900692acb5737ad91db0d to your computer and use it in GitHub Desktop.
A simple AppleScript to prevent VPN session from timing out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on idle | |
set checkIval to 60 | |
set vpnName to "YOUR_VPN_NAME" | |
set pingDest to "PING_DEST_THRU_VPN" | |
tell application "System Events" | |
tell current location of network preferences | |
set vpnConn to service vpnName | |
if vpnConn is not null then | |
if current configuration of vpnConn is connected then | |
do shell script "ping -c 3 " & pingDest | |
end if | |
end if | |
end tell | |
return checkIval | |
end tell | |
end idle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment