diff --git a/content/posts/2024/62-a-slim-dstar-gateway-on-a-raspberry-pi-2/index.md b/content/posts/2024/62-a-slim-dstar-gateway-on-a-raspberry-pi-2/index.md index 1620592..fe2bbfe 100644 --- a/content/posts/2024/62-a-slim-dstar-gateway-on-a-raspberry-pi-2/index.md +++ b/content/posts/2024/62-a-slim-dstar-gateway-on-a-raspberry-pi-2/index.md @@ -582,6 +582,58 @@ pidfile=/var/run/dstargateway/dstargateway.pid user=dstar ~~~ +## Updating hostfiles + +{{< alert "circle-info" >}} +This paragraph has been added on 18 Feb 2024 +{{< /alert >}} + +So we will probably update our hostfiles and I made a little script that +fetches actual hostfiles from trusted sources. But since Archlinux does not +come with any cron installed I could either install one or just use systemd timers. + +I went with the latter one of the options and assuming the script that updates the hostfiles +is located in `/home/dominic/bin/update-hosts.sh` I used these unit-files that I put into +`/usr/lib/systemd/system/`: + +### update-hosts.service + +~~~systemd +[Unit] +Description="Update D-STAR hostfiles" +After=network.target + +[Service] +Type=oneshot +ExecStart=/home/dominic/bin/update-hosts.sh +ExecStartPost=/usr/bin/systemctl restart dstargateway.service + +[Install] +WantedBy=default.target +~~~ + +### update-hosts.timer + +~~~systemd +[Unit] +Description="Update D-STAR hostfiles timer" + +[Timer] +OnBootSec=5min +OnCalendar=daily +RandomizedDelaySec=20min +Unit=update-hosts.service + +[Install] +WantedBy=default.target +~~~ + +Enable the timer and it will run now and daily in future. + +~~~console +$ sudo systemctl enable --now update-hosts.timer +~~~ + ## Install a dashboard I will install the [dashboard from John Hays (K7VE)](https://github.com/johnhays/dsgwdashboard)