From a586a44219ad6e0e16f657298e68562b1074fd79 Mon Sep 17 00:00:00 2001 From: aptalca Date: Sun, 9 Oct 2022 16:15:09 -0400 Subject: [PATCH] streamline wireguard service --- root/etc/s6-overlay/s6-rc.d/svc-wireguard/down | 1 + root/etc/s6-overlay/s6-rc.d/svc-wireguard/finish | 3 +++ root/etc/s6-overlay/s6-rc.d/svc-wireguard/run | 11 ----------- root/etc/s6-overlay/s6-rc.d/svc-wireguard/type | 2 +- root/etc/s6-overlay/s6-rc.d/svc-wireguard/up | 1 + 5 files changed, 6 insertions(+), 12 deletions(-) create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-wireguard/down create mode 100755 root/etc/s6-overlay/s6-rc.d/svc-wireguard/finish create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-wireguard/up diff --git a/root/etc/s6-overlay/s6-rc.d/svc-wireguard/down b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/down new file mode 100644 index 0000000..1bf0210 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/down @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/svc-wireguard/finish \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-wireguard/finish b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/finish new file mode 100755 index 0000000..3403cb9 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/finish @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash + +wg-quick down wg0 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-wireguard/run b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/run index 9ef15b4..8f4e38a 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-wireguard/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/run @@ -1,14 +1,3 @@ #!/usr/bin/with-contenv bash -_term() { - echo "Caught SIGTERM signal!" - wg-quick down wg0 -} - -trap _term SIGTERM - wg-quick up wg0 - -sleep infinity & - -wait diff --git a/root/etc/s6-overlay/s6-rc.d/svc-wireguard/type b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/type index 1780f9f..3d92b15 100644 --- a/root/etc/s6-overlay/s6-rc.d/svc-wireguard/type +++ b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/type @@ -1 +1 @@ -longrun \ No newline at end of file +oneshot \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/svc-wireguard/up b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/up new file mode 100644 index 0000000..5689d7d --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-wireguard/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/svc-wireguard/run \ No newline at end of file