wg-docker/resources/rotate.sh
2022-11-28 21:38:36 +01:00

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;