Thanks for fixing it so quickly!
Would it be possible to use env as the interpreter for systems which don't place bash directly in /bin? I think that's my only other significant local modification to the script on my BSD systems. I.e.,
-#!/bin/bash
+#!/usr/bin/env bash
Best regards,
Conrad
P.S., If it is helpful, I also have some example SystemD unit files for connecting this script up in that universe, which I'm pretty sure I stole from ArchWiki (
https://wiki.archlinux.org/index.php/WireGuard) but I don't remember at this point. It might be nice to other users to shove some version of them in the examples/reresolve-dns directory as an example for folks on systemd.
$ cat wg-reresolve-dns.timer
[Unit]
Description=Periodically reresolve DNS of Wireguard endpoints that have stopped responding
[Timer]
OnCalendar=*:*:0/30
[Install]
WantedBy=timers.target
# The hardcoded wgnet0 below could probably be transformed into an @.service, like wg-quick@.service. Also, dnsmasq.service is just a quirk of my personal DNS configuration; others might depend on different or non-local resolvers.
$ cat wg-reresolve-dns.service
[Unit]
Description=Reresolve DNS of all WireGuard endpoints that have missed a handshake
Wants=network-online.target dnsmasq.service wg-quick@wgnet0.service
After=network-online.target dnsmasq.service wg-quick@wgnet0.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'for i in /etc/wireguard/*.conf; do /usr/share/doc/wireguard/examples/reresolve-dns/reresolve-dns.sh "$i"; done'