wg_stop wieder als extra skript wegen Notify menü
This commit is contained in:
40
wg_stop
Executable file
40
wg_stop
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
########################################################
|
||||
########################################################
|
||||
# Wire-G App for simple management a Wireguard TUNNEL ##
|
||||
# Author: Désiré Werner Menrath ##
|
||||
# Email: polunga40@unity-mail.de ##
|
||||
# Translate German to English with LibreTranslate ##
|
||||
# Translatefiles edit with Poedit ##
|
||||
# Use without warranty! ##
|
||||
########################################################
|
||||
########################################################
|
||||
|
||||
Encoding=UTF-8
|
||||
|
||||
# i18n - Internationalization - Internationalisierung
|
||||
|
||||
export TEXTDOMAIN=wire-g
|
||||
export TEXTDOMAINDIR="/usr/share/locale"
|
||||
|
||||
#Dieser befehl ist notwendig da nach dem import (erster Start) gestartete Tunnel nicht in der .tunnel Datei stehen.
|
||||
nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' > ${WG_WDIR}tunnel.txt
|
||||
#Damit wird der inhalt von /home/$USER/.config/wg_nmcli/tunnel.txt in ein Array gespeichert
|
||||
IFS=$'\n' lines=( $(cat ${WG_WDIR}tunnel.txt) )
|
||||
#echo ${lines[0]} #Damit wird der Inhalt ausgelesen. (Index angeben)
|
||||
VALUE=$"*_*"
|
||||
for VALUE in "${lines[@]}"
|
||||
do
|
||||
# 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
|
||||
yad --image-on-top --image=${WG_PIC}wg-info.png \
|
||||
--undecorated --borders=8 --skip-taskbar \
|
||||
--text-align=center --no-buttons \
|
||||
--timeout 2 --timeout-indicator=bottom \
|
||||
--text=$"<span color='#0fad0a'><b>"$VALUE" Connection</b></span><span> <b>disconnected</b></span>"
|
||||
fi
|
||||
done
|
||||
IFS=$'\n' lines=( $(awk '{print $2}' ${WG_WDIR}for-kill_pid.txt) )
|
||||
kill $lines
|
Reference in New Issue
Block a user