trst pid 16

This commit is contained in:
Désiré Werner Menrath 2023-11-11 21:02:41 +01:00
parent da7d4fe046
commit d97f4a2950

15
wire_g
View File

@ -91,10 +91,10 @@ import_wg(){
nmcli connection import type wireguard file $wgconf &> ${wg_wdir}.tmp.txt nmcli connection import type wireguard file $wgconf &> ${wg_wdir}.tmp.txt
wg_notify wg_notify
else else
pkill yad
nmcli connection import type wireguard file $wgconf &> ${wg_wdir}.tmp.txt nmcli connection import type wireguard file $wgconf &> ${wg_wdir}.tmp.txt
wg_notify wg_notify
fi fi
kill -n $pid
wire_g wire_g
fi ;; fi ;;
@ -146,7 +146,8 @@ remove(){
--text-align=center --button=$"OK" --title "Wire-G Trash" \ --text-align=center --button=$"OK" --title "Wire-G Trash" \
--center --buttons-layout=center --borders=8 --center --buttons-layout=center --borders=8
fi fi
kill -n $pid pkill yad
wg_notify
wire_g wire_g
if [ "$selection" = "$active" ] if [ "$selection" = "$active" ]
then then
@ -174,7 +175,6 @@ up_or_down(){
--center --buttons-layout=center --borders=8 --center --buttons-layout=center --borders=8
else else
wg_stop wg_stop
kill -n $pid
wire_g wire_g
fi } fi }
@ -189,7 +189,7 @@ about(){
a_user=$(whoami) a_user=$(whoami)
wg_pic="/home/$a_user/.icons/" wg_pic="/home/$a_user/.icons/"
version=3.1.3 version=3.1.3
selection=$(yad --title="Wire-G" --center \ yad --title="Wire-G" --center \
--borders=8 --close-on-unfocus \ --borders=8 --close-on-unfocus \
--buttons-layout=center --text-align=center \ --buttons-layout=center --text-align=center \
--button=$"OK" --fixed \ --button=$"OK" --fixed \
@ -199,7 +199,7 @@ about(){
<span color='#626ff1'><b>At all tunnels, the auto start is disabled.</b></span> \n <span color='#626ff1'><b>At all tunnels, the auto start is disabled.</b></span> \n
<span color='#626ff1'><b>Version: $version </b></span> \n <span color='#626ff1'><b>Version: $version </b></span> \n
<span color='#626ff1'><b>Use without warranty.</b></span> \n <span color='#626ff1'><b>Use without warranty.</b></span> \n
<a href='https://git.lunix.dedyn.io/punix/Wire-G'>Download Wire-G </a> \n") <a href='https://git.lunix.dedyn.io/punix/Wire-G'>Download Wire-G </a> \n"
} }
export -f about export -f about
@ -213,6 +213,7 @@ connect(){
if success=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${wg_wdir}.tmp.txt) if success=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${wg_wdir}.tmp.txt)
then then
pkill yad
nmcli con mod $selection connection.autoconnect no nmcli con mod $selection connection.autoconnect no
wg_notify wg_notify
wire_g wire_g
@ -237,16 +238,18 @@ if selection=$(yad --no-klick --list --center \
<b>----------------------------------------------------------------------------------</b> <b>----------------------------------------------------------------------------------</b>
<b>If no tunnels are listed,</b> <b>If no tunnels are listed,</b>
<b>so they have to import their tunnel beforehand.</b>") <b>so they have to import their tunnel beforehand.</b>")
export pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}')
then then
if [[ -n $active ]] if [[ -n $active ]]
then then
wg_stop wg_stop
nmcli connection up $selection &> ${wg_wdir}.tmp.txt nmcli connection up $selection &> ${wg_wdir}.tmp.txt
export pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}')
connect connect
kill -n $pid kill -n $pid
else else
nmcli connection up $selection &> ${wg_wdir}.tmp.txt nmcli connection up $selection &> ${wg_wdir}.tmp.txt
export pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}')
connect connect
kill -n $pid kill -n $pid
fi fi