fix wireguard stopping

This commit is contained in:
Maciej Lebiest 2023-08-01 17:40:45 +02:00
parent 99311fda66
commit 47bc959c53
2 changed files with 15 additions and 4 deletions

View file

@ -17,6 +17,6 @@ RUN dnf install -y \
chmod +x /usr/bin/entrypoint.sh && \
mkdir /setup.d
STOPSIGNAL SIGALRM
STOPSIGNAL SIGINT
ENTRYPOINT [ "/usr/bin/entrypoint.sh" ]

View file

@ -1,11 +1,22 @@
#!/bin/bash
stopcontainer()
{
echo "removing wg0 interface"
wg-quick down /data/wg0.conf
echo goodbye
exit 0
}
trap stopcontainer SIGINT
for file in /setup.d/*;
do
echo "Executing setup file $file";
bash -c "$file";
done
wg-quick up /data/wg0.conf && sleep infinity
echo "removing wg0 interface"
wg-quick down /data/wg0.conf
wg-quick up /data/wg0.conf
while true; do sleep 5; done