I am using ddclient/DDNS under Ubuntu 16.04 LTS to update the IPs which two domains I own (from NameCheap) have a DNS record for (this is working).
However, the issue is that with having two domains, I need two separate instances of ddclient running. I've begun writing two .service
files in order to do this:
/usr/lib/systemd/system/ddclient_website1.service
[Unit]
Description=DDNS client for website1.tld
[Service]
ExecStart=/usr/sbin/ddclient -file /etc/ddclient_website1.conf
[Install]
WantedBy=multi-user.target
/usr/lib/systemd/system/ddclient_website2.service
[Unit]
Description=DDNS client for website2.tld
[Service]
ExecStart=/usr/sbin/ddclient -file /etc/ddclient_website2.conf
[Install]
WantedBy=multi-user.target
With the configurations, specified in the ExecStart commands, as specified below:
/etc/ddclient_website1.conf
daemon=1800
use=web, web=dynamicdns.park-your-domain.com/getip
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=domain_1.tld
password=first_ddns_password
server_name
/etc/ddclient_website2.conf
daemon=1800
use=web, web=dynamicdns.park-your-domain.com/getip
protocol=namecheap
server=dynamicdns.park-your-domain.com
login=domain_2.tld
password=second_ddns_password
server_name
And using systemctl enable ddclient_website1.service
(same for website2) yields:
Created symlink from /etc/systemd/system/multi-user.target.wants/ddclient_website1.service to /usr/lib/systemd/system/ddclient_website1.service.
systemctl start ddclient_website1.service
yields no output.
ps -ef | grep ddclient
lists only the grep just ran, and systemctl status ddclient_website1.service
yields:
● ddclient_website1.service - DDNS client for website1.tld
Loaded: loaded (/usr/lib/systemd/system/ddclient_website1.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sun 2016-12-18 15:34:23 EST; 39s ago
Process: 2687 ExecStart=/usr/sbin/ddclient -file /etc/ddclient_website1.conf (code=exited, status=0/SUCCESS)
Main PID: 2687 (code=exited, status=0/SUCCESS)
Dec 18 15:34:23 server_name systemd[1]: Started DDNS client for website1.tld.
A reboot causes no positive changes.
Edit:
After modification of the .service
files to the default .service
file created during install of ddclient, I am now able to start the services (they are listed in ps -ef | grep ddclient
.
[Unit]
Description=DDNS client for website1.tld
After=network.target
[Service]
Type=forking
PIDFile=/var/run/ddclient_website1.pid
ExecStart=/usr/sbin/ddclient -file /etc/ddclient_website1.conf
[Install]
WantedBy=default.target
However, after running for 40-50 seconds, they timeout, stating the PID files they need to access do not exist (same issue for both services):
● ddclient_website1.service - DDNS client for website1.tld
Loaded: loaded (/usr/lib/systemd/system/ddclient_website1.service; enabled; vendor preset: enabled)
Active: failed (Result: timeout) since Sun 2016-12-18 16:04:14 EST; 22s ago
Process: 1347 ExecStart=/usr/sbin/ddclient -file /etc/ddclient_website1.conf (code=exited, status=0/SUCCESS)
Dec 18 16:02:44 server_name systemd[1]: Starting DDNS client for website1.tld...
Dec 18 16:02:44 server_name systemd[1]: ddclient_website1.service: PID file /var/run/ddclient_website1.pid not readable (yet?) after start: No such file or directory
Dec 18 16:04:14 server_name systemd[1]: ddclient_website1.service: Start operation timed out. Terminating.
Dec 18 16:04:14 server_name systemd[1]: Failed to start DDNS client for website1.tld.
Dec 18 16:04:14 server_name systemd[1]: ddclient_website1.service: Unit entered failed state.
Dec 18 16:04:14 server_name systemd[1]: ddclient_website1.service: Failed with result 'timeout'.
I touch
ed ddclient_website1.pid
(also for website2) into /var/run
and achieved the same result.