wait in RET entfernt awk mit cat ersetzt

This commit is contained in:
Désiré Werner Menrath 2023-11-18 09:52:55 +01:00
parent 7989fda162
commit bcc362c007

9
wire_g
View File

@ -63,7 +63,7 @@ wg_notify(){
# Schreib die pid von Notify in # Schreib die pid von Notify in
pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}') pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}')
echo $pid > ${WG_WDIR}for-kill_pid.txt echo $pid > ${WG_WDIR}for-kill_pid.txt
IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}for-kill_pid.txt) ) # awk '{print $2}' heist, zeig mir nur die zweite Nummer an IFS=$'\n' lines=( $(cat ${WG_WDIR}for-kill_pid.txt) )
} }
@ -149,7 +149,7 @@ remove(){
if [ "$SELECTION" = "$ACTIVE" ] if [ "$SELECTION" = "$ACTIVE" ]
then then
IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}for-kill_pid.txt) ) IFS=$'\n' lines=( $(cat ${WG_WDIR}for-kill_pid.txt) )
kill $lines kill $lines
fi } fi }
@ -233,21 +233,18 @@ RET=$?
if [[ $RET -eq 2 ]] if [[ $RET -eq 2 ]]
then then
up_or_down up_or_down
wait
wire_g wire_g
fi fi
if [[ $RET -eq 3 ]] if [[ $RET -eq 3 ]]
then then
import_wg import_wg
wait
wire_g wire_g
fi fi
if [[ $RET -eq 4 ]] if [[ $RET -eq 4 ]]
then then
remove remove
wait
wire_g wire_g
fi fi
@ -264,12 +261,10 @@ if [[ $RET -eq 0 ]]
wg_stop wg_stop
nmcli connection up $SELECTION &> ${WG_WDIR}.tmp.txt nmcli connection up $SELECTION &> ${WG_WDIR}.tmp.txt
connect connect
wait
wire_g wire_g
else else
nmcli connection up $SELECTION &> ${WG_WDIR}.tmp.txt nmcli connection up $SELECTION &> ${WG_WDIR}.tmp.txt
connect connect
wait
wire_g wire_g
fi fi
fi fi