Add Cloudflare DDNS updater scripts and systemd configurations

This commit is contained in:
Nikholas Pcenicni
2026-03-21 11:09:18 -04:00
parent 60348eef9b
commit a4d8165dc2
8 changed files with 162 additions and 0 deletions

29
dyndns/git-sync.sh Normal file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# git-sync.sh - pull changes and run deploy.sh if updated
set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${REPO_DIR}"
git fetch --all --prune
UPDATED=0
if git rev-parse --abbrev-ref --symbolic-full-name @{u} >/dev/null 2>&1; then
LOCAL="$(git rev-parse @)"
REMOTE="$(git rev-parse @{u})"
if [ "${LOCAL}" != "${REMOTE}" ]; then
UPDATED=1
fi
else
out="$(git pull --rebase 2>&1 || true)"
if ! echo "${out}" | grep -q "Already up"; then
UPDATED=1
fi
fi
if [ "${UPDATED}" -eq 1 ]; then
echo "$(date -Iseconds) Repo updated -> running deploy.sh"
"${REPO_DIR}/deploy.sh"
else
echo "$(date -Iseconds) Repo unchanged"
fi