diff options
author | Xiao Pan <xyz@flylightning.xyz> | 2025-07-14 00:09:38 +0800 |
---|---|---|
committer | Xiao Pan <xyz@flylightning.xyz> | 2025-07-14 00:09:38 +0800 |
commit | 7f118db2567822289fd2f7be5624f2e7ce044067 (patch) | |
tree | 891a2d69cdc9a61e3da3f965c6e612d06d3a0d08 | |
parent | 98eebe848bd049062f4ffb4742e08835f593c535 (diff) |
feat: vpn kill monerod before wg_ba down
-rwxr-xr-x | sh/vpn | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1,6 +1,7 @@ #!/bin/sh # toggle VPN + down_not_master () { git -C "$HOME/programs/config_local_arch" branch | awk '!/master/{print ($1=="*")?$2:$1}' | while read -r v; do nmcli connection down "wg_$v" @@ -9,6 +10,8 @@ down_not_master () { # no toggle wg_master, I want wg_master to always on by default if ! [ "$1" ] || [ "$1" = master ]; then + # kill monerod before wg_ba down + killall -w monerod down_not_master nmcli connection up wg_master notify-send -u critical 'VPN disabled' @@ -16,10 +19,12 @@ if ! [ "$1" ] || [ "$1" = master ]; then fi if nmcli -t --fields device,state device | grep -q "^wg_$1:connected$"; then + killall -w monerod down_not_master nmcli connection up wg_master notify-send -u critical "$1 VPN disabled" else + [ "$1" != ba ] && killall -w monerod down_not_master nmcli connection down wg_master nmcli connection up "wg_$1" |