13 lines
425 B
Bash
Executable file
13 lines
425 B
Bash
Executable file
#!/bin/bash
|
|
|
|
iface="$(ip l | grep mullvad | awk '{print $2}' | sed 's/://')";
|
|
# Delete entry-iface
|
|
[ -z $iface ] \
|
|
&& iface="$(ip l | grep wg | awk '{print $2}' | sed 's/://')" \
|
|
&& /usr/bin/wg-quick down $iface;
|
|
|
|
# Select a random config file
|
|
new_iface="$(ls /etc/wireguard/mullvad/ | sort -R | tail -1)";
|
|
|
|
/usr/bin/wg-quick down /etc/wireguard/mullvad/$iface.conf;
|
|
/usr/bin/wg-quick up /etc/wireguard/mullvad/$new_iface;
|