Question I need to restart a service each time to make it work

derek wildstar

Prominent
Feb 14, 2020
24
0
510
0
Hi
Since I don't have a public static IP I signed up a DDNS service in order to get access to a few service in my LAN server from the Internet. I followed this instruction and it works properly:
https://www.dynu.com/DynamicDNS/IPUpdateClient/Linux

I run:

systemctl status dynuiuc.service

Loaded: loaded (/lib/systemd/system/dynuiuc.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-01-16 14:26:35 CET; 2min 39s ago


Although the service seems to be working, my IP is not updated automatically at any system startup unless I run the command:

systemctl restart dynuiuc.service

write down my user password in the pop up windows
Then, I run systemctl status dynuiuc.service again, and this time, I can see that my public IP got updated:

gen 16 14:33:27 jack-pc /usr/bin/dynuiuc[4336]: Configuration of /usr/bin/dynuiuc read from file /etc/dynuiuc/dynuiuc.conf
gen 16 14:33:33 black-pc /usr/bin/dynuiuc[4336]: { IPv4 Address: xx.xx.xx.92, IPv6 Address: }


What did I fail to do and understand here?
I'd like to make it work and got my Ip update at the system startup. Do I need to set a cronjob or something?
Could you please help me figure it out?
Thanks
 

dmroeder

Distinguished
Jan 15, 2005
1,333
9
19,465
60
Hmm, can you copy/paste the contents of dynuiuc.service here?

I wonder if it needs to be configured to start the service until after the network adapter is up?

Code:
[Unit]
Wants=network-online.target
After=network-online.target
 

derek wildstar

Prominent
Feb 14, 2020
24
0
510
0
Hmm, can you copy/paste the contents of dynuiuc.service here?

I wonder if it needs to be configured to start the service until after the network adapter is up?

Code:
[Unit]
Wants=network-online.target
After=network-online.target
What is this?

file

/lib/systemd/system/dynuiuc.service


Code:
[Unit]
Description=Dynu IP update client daemon

[Service]
Type=forking
PIDFile=/var/run/dynuiuc.pid
ExecStart=/usr/bin/dynuiuc --conf_file /etc/dynuiuc/dynuiuc.conf --log_file /var/log/dynuiuc.log --pid_file /run/dynuiuc.pid --daemon
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Thank you
 

dmroeder

Distinguished
Jan 15, 2005
1,333
9
19,465
60
If I'm not mistaken, the location you mentioned is where the default configurations exist when you install that program (/lib/systemd). I believe that configuration file gets copied to /etc/systemd/system, which is where the systemd services exist and are executed from.

If I'm right, what I would try is adding the 2 lines to that service in the /etc location. So it would look like what I have below. Of course, make a backup of the existing configuration. I don't really know anything about the service you are running, I'm only speculating that it is starting too soon since it works fine after you restart it.

Code:
[Unit]
Description=Dynu IP update client daemon
Wants=network-online.target
After=network-online.target

[Service]
Type=forking
PIDFile=/var/run/dynuiuc.pid
ExecStart=/usr/bin/dynuiuc --conf_file /etc/dynuiuc/dynuiuc.conf --log_file /var/log/dynuiuc.log --pid_file /run/dynuiuc.pid --daemon
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
 

ASK THE COMMUNITY

TRENDING THREADS