Variablen alle großschreibung (zwischencommit)
This commit is contained in:
27
wg_stop
27
wg_stop
@ -14,28 +14,27 @@ Encoding=UTF-8
|
||||
|
||||
# i18n - Internationalization - Internationalisierung
|
||||
|
||||
export textdomain=wire-g
|
||||
export textdomaindir="/usr/share/locale"
|
||||
export TEXTDOMAIN=wire-g
|
||||
export TEXTDOMAINDIR="/usr/share/locale"
|
||||
|
||||
############################################################################################################
|
||||
############################################################################################################
|
||||
|
||||
a_user=$(whoami)
|
||||
wg_wdir="/home/$a_user/.config/wg_nmcli/"
|
||||
wg_pic="/home/$a_user/.icons/"
|
||||
WG_WDIR="/home/$USER/.config/wg_nmcli/"
|
||||
WG_PIC="/home/$USER/.icons/"
|
||||
#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/$a_user/.config/wg_nmcli/.tunnel.txt in ein Array gespeichert
|
||||
IFS=$'\n' lines=( $(cat ${wg_wdir}.tunnel.txt) )
|
||||
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)
|
||||
wert=$"*_*"
|
||||
for wert in "${lines[@]}"
|
||||
VALUE=$"*_*"
|
||||
for VALUE in "${lines[@]}"
|
||||
do
|
||||
# hier wird die Ausgabe von nmcli für die auswertung in die .stop.txt gespeichert
|
||||
nmcli connection down "$wert" &> ${wg_wdir}.stop.txt
|
||||
if disable=$(grep -i 'deaktiviert\|deactivated' ${wg_wdir}.stop.txt)
|
||||
# hier wird die Ausgabe von nmcli für die ausVALUEung in die .stop.txt gespeichert
|
||||
nmcli connection down "$VALUE" &> ${WG_WDIR}.stop.txt
|
||||
if disable=$(grep -i 'deaktiviert\|deactivated' ${WG_WDIR}.stop.txt)
|
||||
then
|
||||
notify-send --icon=${wg_pic}wg-stop.png $"$wert Connection disconnected"
|
||||
notify-send --icon=${WG_PIC}wg-stop.png $"$VALUE Connection disconnected"
|
||||
fi
|
||||
done
|
||||
pkill yad
|
||||
|
Reference in New Issue
Block a user