Baseline modular DNS sync

This commit is contained in:
Lyncoln
2026-09-19 15:03:45 -04:00
commit 47850e3ce5
21 changed files with 957 additions and 0 deletions
Executable
+44
View File
@@ -0,0 +1,44 @@
#!/bin/sh
set -u
INTERVAL_MINUTES="${SYNC_INTERVAL:-1}"
case "$INTERVAL_MINUTES" in
''|*[!0-9]*)
echo "ERROR: SYNC_INTERVAL must be an integer number of minutes" >&2
exit 1
;;
esac
if [ "$INTERVAL_MINUTES" -lt 1 ]; then
echo "ERROR: SYNC_INTERVAL must be at least 1 minute" >&2
exit 1
fi
INTERVAL_SECONDS=$((INTERVAL_MINUTES * 60))
sleep_pid=""
shutdown() {
echo "Stopping DNS sync service..."
[ -z "$sleep_pid" ] || kill "$sleep_pid" 2>/dev/null || true
exit 0
}
trap shutdown INT TERM
echo "DNS sync service started"
echo "Sync interval: ${INTERVAL_MINUTES} minute(s)"
echo "Source plugin: ${PROXY:-npm}"
echo "DNS provider: ${DNS_PROVIDER:-verizon}"
while :; do
echo
echo "=== DNS sync: $(date -Iseconds) ==="
if python -m dns_sync sync; then
echo "Sync run completed successfully"
else
rc=$?
echo "ERROR: Sync run failed with exit code ${rc}" >&2
fi
sleep "$INTERVAL_SECONDS" &
sleep_pid=$!
wait "$sleep_pid" || true
sleep_pid=""
done