From 9199ead91bc513c5ce3699091d7f1e25a3a1a71e Mon Sep 17 00:00:00 2001 From: punix Date: Wed, 15 Nov 2023 20:08:09 +0100 Subject: [PATCH] test mit kill --- wg_stop | 5 +++-- wire_g | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/wg_stop b/wg_stop index 2ac7741..35f484f 100755 --- a/wg_stop +++ b/wg_stop @@ -30,7 +30,7 @@ export TEXTDOMAINDIR="/usr/share/locale" VALUE=$"*_*" for VALUE in "${lines[@]}" do - # hier wird die Ausgabe von nmcli für die ausVALUEung in die .stop.txt gespeichert + # hier wird die Ausgabe von nmcli für die auswertung in die .stop.txt gespeichert nmcli connection down "$VALUE" &> ${WG_WDIR}.stop.txt if disable=$(grep -i 'deaktiviert\|deactivated' ${WG_WDIR}.stop.txt) then @@ -41,7 +41,8 @@ export TEXTDOMAINDIR="/usr/share/locale" --text=$""$VALUE" Connection disconnected" fi done -pkill yad + IFS=$'\n' lines=( $(cat ${WG_WDIR}Notify_PID.txt) ) + kill $lines > /dev/null 2>&1 ################################# END ################################################################## ############################################################################################################ diff --git a/wire_g b/wire_g index 1ffc6da..eb01677 100755 --- a/wire_g +++ b/wire_g @@ -60,10 +60,11 @@ wg_notify(){ --text=$"$ACTIVE activ" \ --menu="Wire-G $OPEN!/sbin/wire_g |$ACTIVE stop!/sbin/wg_stop" \ - --command="menu" + --command="menu" & # Schreib die pid von Notify in - ps aux | grep yad | grep -v grep | awk '{print $2}' > ${WG_WDIR}Notify_PID.txt -} + pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') + echo $pid > ${WG_WDIR}Notify_PID.txt +} export -f wg_notify # function end