How to control VPN client via commandline

2

2

There must be a way to control the built-in VPN client in OS-X Snow Leopard, I simply can't find documentation about it. I want to be able to connect and disconnect while I'm ssh'd into my box remotely. Does anyone know how to do that?

Michael Caron

Posted 2010-05-05T17:37:07.050

Reputation: 235

Answers

1

save the following AppleScript to gfw.scpt

tell application "System Events"
    tell current location of network preferences
        set VPNservice to service "The Great Fire Wall" -- name of the VPN service
        if exists VPNservice then connect VPNservice
        set isConnected to connected of current configuration of VPNservice
        if isConnected then
            --- do something or nothing
        end if
    end tell
end tell

use osascript gfw.scpt to start it from terminal.

freewizard

Posted 2010-05-05T17:37:07.050

Reputation: 241

Gotta love AppleScript... so verbose. :( – Michael Caron – 2010-05-07T13:22:15.963

I'm using this in Terminal.app which works ok. Does it work for you via ssh? – freewizard – 2010-05-19T05:37:23.577

No: startIntelix.scpt:50:58: script error: Expected end of line but found identifier. (-2741) – Michael Caron – 2010-05-24T18:20:14.317