14 lines
425 B
Bash
14 lines
425 B
Bash
|
#!/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;
|