ユーザ用ツール

サイト用ツール


applescript:vpn

文書の過去の版を表示しています。


vpnに接続

コマンドラインでvpn接続を切り替える

``` tell application “System Events”

tell current location of network preferences
  set vpn to the service "サービス名"
	
  if current configuration of vpn is not connected then
    connect vpn
  else
    disconnect vpn
  end if
end tell

end tell ```

`サービス名`にはシステム環境設定のネットワークで作成したVPNのサービス名を正確に入れる(空白に注意)

これを適当な名前で保存し、以下のコマンドでvpn切り替えができる

``` osascript path/to/this/applescript/file ```

bashrcなどに以下の記述をしておくと良いだろう

``` alias vpn=“osascript path/to/this/applescript/file” ```

applescript/vpn.1646883922.txt.gz · 最終更新: 2022/03/10 03:45 by nullpon