Install code on respective boxes. On the server, install in /opt/ip-updater/. On the client install in /opt/ip-updater-node. Remove CLIENT- or SERVER- from the filenames.
Make sure that the IP addresses, host names, and file paths are all filled in. Don't forget to make the *.sh files executable.
Copy the *.service and *.socket files into /etc/systemd/system/ and run systemctl daemon-reload and systemctl enable ip_updater... on all of your boxes. Note: Symlinks will not work
These services should be available upon reboot.
Note: The machine with a static IP must be the server and must be fully running before the clients boot to make sure the message makes it to the hosts file of the server with the static IP.
In the client service try using
network-online.target. This essentially waits to run your service until all of the automatic connections either succeed, fail or time out. You might also want to use theWantsdirective. This maybe isn't totally necessary but if for whatever reason something goes wonky you can use this to make sure that thenetwork-online.targetunit is started before your own unit activates.So if you do something like this:
you are making sure your dependency units are run first and your own unit isn't run until they are completed.
Edit: Wants is similar to Requires, just less strict. It will attempt to run the listed units but if they fail or are missing, the current unit will continue to run.
Edit 2: I should clarify that this may not fix the issue. These are just changes that could be a good idea to make.