Last active
July 3, 2022 20:04
-
-
Save afiestas/be5b4254de13991b6b6d914ad5f61b59 to your computer and use it in GitHub Desktop.
systemd timer for ddns/dyndns/dynamic dns or any other http request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/ddns.service | |
[Unit] | |
Description=Updates ddns via curl | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/curl "https://your request goes here" | |
#You might have or want to change user/group | |
#User=nobody | |
#Group=nogroup | |
#Or just use a dynamically generated one | |
DynamicUser=yes | |
PrivateTmp=yes | |
ProtectSystem=strict | |
ProtectHome=true | |
MemoryDenyWriteExecute=yes | |
PrivateDevices=true | |
PrivateUsers=true | |
ProtectKernelTunables=true | |
ProtectKernelModules=true | |
ProtectControlGroups=true | |
RestrictNamespaces=true | |
LockPersonality=true | |
RestrictRealtime=true | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/ddns.timer | |
# systemctl enable ddns.timer | |
# systemctl start ddns.timer | |
[Unit] | |
Description=Update a ddns provider | |
[Timer] | |
OnBootSec=1s | |
OnUnitActiveSec=30s | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a scenario like this, you might simply want to use
DynamicUser=yes
instead ofUser=
/Group=
(requires>=systemd-232
).