mirror of
https://codeberg.org/polyteknisk-radiogruppe/the_prg_server_configuration.git
synced 2026-06-14 02:38:58 +02:00
Add systemd service and timer for PRG Cloudflare DDNS updater. Update script shebang.
This commit is contained in:
parent
afdcca6f53
commit
f3b0eaf58a
1 changed files with 26 additions and 2 deletions
|
|
@ -578,7 +578,7 @@ in {
|
||||||
# PRG Cloudflare DDNS updater - split into a single-run upstream script and a wrapper that loops records
|
# PRG Cloudflare DDNS updater - split into a single-run upstream script and a wrapper that loops records
|
||||||
environment.etc."cloudflare-ddns/update-single.sh" = {
|
environment.etc."cloudflare-ddns/update-single.sh" = {
|
||||||
text = ''
|
text = ''
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
## K0p1-Git cloudflare-ddns-updater (packaged copy)
|
## K0p1-Git cloudflare-ddns-updater (packaged copy)
|
||||||
## Upstream: https://github.com/K0p1-Git/cloudflare-ddns-updater
|
## Upstream: https://github.com/K0p1-Git/cloudflare-ddns-updater
|
||||||
## Author: K0p1-Git
|
## Author: K0p1-Git
|
||||||
|
|
@ -741,7 +741,8 @@ in {
|
||||||
else
|
else
|
||||||
export record_name="$r.${domain}"
|
export record_name="$r.${domain}"
|
||||||
fi
|
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
|
done
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
@ -757,6 +758,29 @@ in {
|
||||||
wants = ["acme-finished-prg-radio.org.target"];
|
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.allowedTCPPorts = [80 443 10022 30033 8448 9001 3001 993 465 25];
|
||||||
networking.firewall.allowedUDPPorts = [80 443 9987 9001 3001 993 465 25];
|
networking.firewall.allowedUDPPorts = [80 443 9987 9001 3001 993 465 25];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue