[systemd-devel] Only start a tomcat server when you are sure that time-sync.target is online
Jan Hugo Prins
jhp at jhprins.org
Thu Mar 25 13:41:09 UTC 2021
Hello,
In our platform we have a dependency where we want to be sure that the
time-sync.target is online before we start our application servers. We
do this because we really want to be sure that the time on the
application server is in sync with our NTP servers. The downside of the
way we have done this at the moment is that making a configuration
change on ntp.conf results in a restart of ntpd, which in turn results
in a restart of the application servers. This is really not what we
want, because we actually want to be sure that the time is correct, and
a restart of the ntpd service on a server doesn't put the time on the
server at risk immediately.
Our current configuration looks roughly like this:
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target time-sync.target
Requires=time-sync.target
[Service]
Type=simple
ExecStart=Startscripts
ExecStop=Stopscript
SuccessExitStatus=143
User=tomcatuser
Group=tomcatuser
Restart=on-failure
[Install]
WantedBy=multi-user.target
The problem line is the Requires line in there I think.
Does systemd give me a different way to check if the time is in sync?
Is there a way to create this dependency without implying a restart when
ntpd restarts?
Jan Hugo Prins
More information about the systemd-devel
mailing list