blah
This commit is contained in:
parent
a27975e3b4
commit
3b14de2e60
3
watch_wg.sh
Executable file
3
watch_wg.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
watch --color WG_COLOR_MODE=always wg
|
12
wifi-wg.service
Normal file
12
wifi-wg.service
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Auto WiFi Wireguard connect
|
||||||
|
After=network.target
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment="DISPLAY=:0"
|
||||||
|
Restart=always
|
||||||
|
ExecStart=sudo wpa_cli -i wlo1 -a /home/william/wpa.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=graphical.target
|
27
wpa.sh
Executable file
27
wpa.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# redirect all output into a logfile
|
||||||
|
# exec 1>> /tmp/test.log 2>&1
|
||||||
|
|
||||||
|
case "$2" in
|
||||||
|
CONNECTED)
|
||||||
|
# do stuff on connect with wlan0
|
||||||
|
sleep 2;
|
||||||
|
|
||||||
|
if grep -Fxq `iwgetid --ap --raw` /etc/theta_wg/ignore.txt
|
||||||
|
then
|
||||||
|
echo "none"
|
||||||
|
else
|
||||||
|
# code if not found
|
||||||
|
wg-quick up wg0-ron
|
||||||
|
fi
|
||||||
|
|
||||||
|
;;
|
||||||
|
DISCONNECTED)
|
||||||
|
# do stuff on disconnect with wlan0
|
||||||
|
wg-quick down wg0-ron
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
>&2 echo empty or undefined event for wlan0: "$2"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
x
Reference in New Issue
Block a user