Skip to content

Instantly share code, notes, and snippets.

@cedriczirtacic
Last active May 3, 2024 20:24
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cedriczirtacic/34eb40702e21b64a0a2924fc161f71ce to your computer and use it in GitHub Desktop.
Save cedriczirtacic/34eb40702e21b64a0a2924fc161f71ce to your computer and use it in GitHub Desktop.
Systemd ddclient.service
#/usr/lib/systemd/system/ddclient.service
[Unit]
Description=ddclient Service
After=network.target
[Service]
Type=forking
PIDFile=/var/run/ddclient.pid
ExecStart=/sbin/ddclient -pid /var/run/ddclient.pid -file /etc/ddclient/ddclient.conf -daemon 300
ExecStop=/usr/bin/pkill -SIGKILL -P /var/run/ddclient.pid
@trogper
Copy link

trogper commented Jan 15, 2021

I have modified it to work without forking and pidfile and under separate user. This is for debian based systems, as the paths are different.
/etc/systemd/system/ddclient.service:

[Unit]
Description=ddclient Service
After=network.target

[Service]
User=ddclient
Group=ddclient
ExecStart=/usr/sbin/ddclient -file /etc/ddclient.conf -foreground -daemon 300

[Install]
WantedBy=multi-user.target

install ddclient from apt, create service and create user (the package does have it's own sysV init script/service, this is only necessary if you want to run ddclient under non-root/restricted user)

apt install ddclient

systemctl disable ddclient
rm /etc/init.d/ddclient
# install the service file
systemctl daemon-reload
systemctl enable ddclient

useradd -s /usr/sbin/nologin -r -M ddclient
chown ddclient /etc/ddclient.conf /var/cache/ddclient -R
chmod g+rw /var/cache/ddclient/ddclient.cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment