Dateien nach "/" hochladen

This commit is contained in:
2023-10-28 21:38:26 +02:00
parent a233e51d67
commit 3f1330f850
5 changed files with 268 additions and 0 deletions

29
wg_stop Normal file
View File

@ -0,0 +1,29 @@
#!/bin/bash
############################################################################################################
############################################################################################################
a_user=$(whoami)
wg_wdir="/home/$a_user/.config/wg_nmcli/"
wg_pic="/home/$a_user/.icons/"
#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) )
#echo ${lines[0]} #Damit wird der Inhalt ausgelesen. (Index angeben)
wert=$"*_*"
for wert in "${lines[@]}"
do
# rm /home/$a_user/.config/wg_nmcli/.tunnel.txt # falls Wireguard nicht richtig funktioniert hier die # wegnehmen
# hier wird die Ausgabe von nmcli für die auswertung in die .stop.txt gespeichert
nmcli connection down $wert &> ${wg_wdir}.stop.txt
disable=$(grep -i "deaktiviert" ${wg_wdir}.stop.txt)
if [ "$?" = "0" ]
then
notify-send --icon=${wg_pic}wg-stop.png "$wert Verbindung wurde getrennt."
pkill yad
fi
done
################################# ENDE #################################################################
############################################################################################################