diff options
| author | Craig Jennings <c@cjennings.net> | 2025-05-28 15:05:53 -0500 | 
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-05-28 15:05:53 -0500 | 
| commit | d68842c1bd9001d660f889e193785193cb2dabd2 (patch) | |
| tree | d7683499c9011401d1995b09ebd9c0b695dc7331 /dotfiles | |
| parent | fc1221f70526353c78971b242079f182dd183ec9 (diff) | |
add wireguard up/down functions
Diffstat (limited to 'dotfiles')
| -rw-r--r-- | dotfiles/system/.profile.d/fzf.sh | 14 | 
1 files changed, 13 insertions, 1 deletions
| diff --git a/dotfiles/system/.profile.d/fzf.sh b/dotfiles/system/.profile.d/fzf.sh index 2193614..f195440 100644 --- a/dotfiles/system/.profile.d/fzf.sh +++ b/dotfiles/system/.profile.d/fzf.sh @@ -76,9 +76,11 @@ bk() {      fi  } + +  # close wireguard connection first if already running, then  # run wireguard, selecting the configuration file. -wg() { +wgup() {      # Check if wireguard is running      output=$(sudo wg)      if [[ -n "$output" ]]; then @@ -95,3 +97,13 @@ wg() {          sudo wg      fi  } +wgdown() { +    # Check if wireguard is running +    output=$(sudo wg) +    if [[ -n "$output" ]]; then +        # Shutdown all wg interfaces if WireGuard is currently running. +        for iface in $(sudo wg show interfaces); do +            sudo wg-quick down "${iface}" +        done +    fi +} | 
