From e354c1c04e1db3157c3c36b7267d102a5953cfc3 Mon Sep 17 00:00:00 2001 From: punix Date: Sat, 11 Nov 2023 19:21:03 +0100 Subject: [PATCH] test 8 pid --- wire_g | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/wire_g b/wire_g index 050937a..dcf0efa 100755 --- a/wire_g +++ b/wire_g @@ -42,7 +42,6 @@ wg_notify(){ a_user=$(whoami) active=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//') wg_pic="/home/$a_user/.icons/" - pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') case $LANG in de_DE.UTF-8) open=öffnen ;; @@ -61,10 +60,6 @@ wg_notify(){ --menu="Wire-G $open!/sbin/wire_g |$active stop!/sbin/wg_stop" \ --command="menu" - while [[ -z $active ]] - do - kill $pid - done } export -f wg_notify @@ -151,11 +146,12 @@ remove(){ --text-align=center --button=$"OK" --title "Wire-G Trash" \ --center --buttons-layout=center --borders=8 fi - # if [ "$selection" = "$active" ] - # then - # pkill wire_g - # kill yad - # fi + if [ "$selection" = "$active" ] + then + pkill wire_g + kill yad + wire_g + fi fi } export -f remove @@ -235,7 +231,7 @@ if selection=$(yad --no-klick --list --center \ --text=$"Activ Tunnel: $active ---------------------------------------------------------------------------------- If no tunnels are listed, -so they have to import their tunnel beforehand.") +so they have to import their tunnel beforehand.") & then if [[ -n $active ]] then @@ -243,11 +239,14 @@ if selection=$(yad --no-klick --list --center \ nmcli connection up $selection &> ${wg_wdir}.tmp.txt connect pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') + kill $pid + wire_g else nmcli connection up $selection &> ${wg_wdir}.tmp.txt connect pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') - + kill $pid + wire_g fi fi