Start a VPN session using a Terminal script

Posted by craibuc on Server Fault See other posts from Server Fault or by craibuc
Published on 2010-02-15T18:36:58Z Indexed on 2010/04/15 16:03 UTC
Read the original article Hit count: 203

Filed under:
|
|
|
|

I use an OSX Terminal session to start a VPN connection. The command that I execute at the prompt is:

/etc/netlock/cvc -c ::

This works as expected.

I would like to save this to a script file that I can simply double-click to start.

I created a file, 'vpn.command', added the command (list above), save it, and given execute permission:

chmod +x vpn.command

When I double-click the file, Terminal opens a BASH shell, executes the command, then exits. Upon closer inspection, the command is now '/etc/netlock/cvc -c ::; exit;'

Why is the extra '; exit;' appended to my command?

BTW, is there a way to execute another command, /etc/netlock/cvc -d, when the Terminal session is being closed so I can close the VPN automatically?

© Server Fault or respective owner

Related posts about osx

Related posts about bash