[systemd-devel] Antw: [EXT] Only start a tomcat server when you are sure that time-sync.target is online

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Thu Mar 25 14:33:02 UTC 2021


>>> Jan Hugo Prins <jhp at jhprins.org> schrieb am 25.03.2021 um 14:41 in
Nachricht
<227be317-1e1e-42b9-f871-70b790594819 at jhprins.org>:
> 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.

Actually it depends: If your time was off, because the ntp configuration was
broken,
it might make sense to wait. Despite of that many changes can be applied to
ntp by runtime reconfiguration, so you can avoid restarting ntp in a lot of
cases.

> 
> 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
> 
> 
> _______________________________________________
> systemd‑devel mailing list
> systemd‑devel at lists.freedesktop.org 
> https://lists.freedesktop.org/mailman/listinfo/systemd‑devel 





More information about the systemd-devel mailing list