Add systemd service and timer for PRG Cloudflare DDNS updater. Update script shebang.

This commit is contained in:
Root User 2026-03-03 11:54:27 +01:00
parent afdcca6f53
commit f3b0eaf58a
Signed by: root
GPG key ID: 087F0A95E5766D72

View file

@ -578,7 +578,7 @@ in {
# PRG Cloudflare DDNS updater - split into a single-run upstream script and a wrapper that loops records
environment.etc."cloudflare-ddns/update-single.sh" = {
text = ''
#!/bin/bash
#!/usr/bin/env bash
## K0p1-Git cloudflare-ddns-updater (packaged copy)
## Upstream: https://github.com/K0p1-Git/cloudflare-ddns-updater
## Author: K0p1-Git
@ -741,7 +741,8 @@ in {
else
export record_name="$r.${domain}"
fi
/etc/cloudflare-ddns/update-single.sh || true
# Invoke the single-run script explicitly with the system's bash via env to avoid /bin/bash shebang issues
/usr/bin/env bash /etc/cloudflare-ddns/update-single.sh || true
done
'';
@ -757,6 +758,29 @@ in {
wants = ["acme-finished-prg-radio.org.target"];
};
systemd.services.prg-cloudflare-ddns-updater = {
description = "PRG Cloudflare DDNS updater";
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "/usr/bin/env bash /etc/cloudflare-ddns/update.sh";
User = "traefikprg";
# Make sure the service doesn't fail the boot if the script exits non-zero
Restart = "no";
};
};
systemd.timers.prg-cloudflare-ddns-updater = {
description = "Run PRG Cloudflare DDNS updater hourly";
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "1m"; # run shortly after boot
OnUnitActiveSec = "1h"; # then every hour
AccuracySec = "1m";
};
};
networking.firewall.allowedTCPPorts = [80 443 10022 30033 8448 9001 3001 993 465 25];
networking.firewall.allowedUDPPorts = [80 443 9987 9001 3001 993 465 25];