PiFrameFleet/root/etc/services.d/wireguard/run

21 lines
314 B
Plaintext
Executable File

#!/usr/bin/with-contenv bash
# Adapted from https://github.com/linuxserver/docker-wireguard
if [ "$ENABLE_WIREGUARD" = false ] ; then
exit
fi
_term() {
echo "Caught SIGTERM signal!"
wg-quick down /opt/wireguard/wg0.conf
}
trap _term SIGTERM
wg-quick up /opt/wireguard/wg0.conf
sleep infinity &
wait