Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shut Off All VPNs with vpnutil #13

Open
lukerbs opened this issue Dec 6, 2021 · 2 comments
Open

Shut Off All VPNs with vpnutil #13

lukerbs opened this issue Dec 6, 2021 · 2 comments

Comments

@lukerbs
Copy link

lukerbs commented Dec 6, 2021

Hi,

Is there a way to shut off all VPNs with a single command using vpnutil?

Thanks

@Timac
Copy link
Owner

Timac commented Dec 10, 2021

vpnutil can stop one single VPN with the command:

vpnutil stop MyVPN

It has no built-in command to stop all VPNs (could be an interesting new feature). However you could write a simple script using vpnutil to stop each VPN one by one. For example a bash script like:

#!/bin/bash

vpnutil stop MyVPN1
vpnutil stop MyVPN2

@dronenb
Copy link

dronenb commented Jan 25, 2024

@lukerbs you can use the following bash script using the new machine readable vpnutil list output (assumes you also have jq CLI installed):

#!/usr/bin/env bash

ORIG_IFS="${IFS}"
IFS=$'\n'
for vpn_name in $(vpnutil list  | jq -r '.VPNs[].name'); do
  vpnutil stop "${vpn_name}"
done
IFS="${ORIG_IFS}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants