[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 14:11:54 UTC 2021


Hi,

> > 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?
> https://unix.stackexchange.com/questions/388586/systemd-requires-vs-wants
> <https://unix.stackexchange.com/questions/388586/systemd-requires-vs-wants>
>
> just replace "Requires" with "Wants", it does exactly the same but your
> Tomcat would also get started if "time-sync.target" is missing *but* it
> would not be stopped just because ntpd is stopped
>
> there are really very few cases when Requires is really what someone wants

We first tried it with wants, but wants does start the application
server even if the time-sync.target does not work.

>From the man page:
           Units listed in this option will be started if the
configuring unit is. *However, if the listed units fail to start or
cannot be added to the**
**           transaction, this has no impact on the validity of the
transaction as a whole*, and this unit will still be started. This is
the recommended
           way to hook the start-up of one unit to the start-up of
another unit.

We don't want tomcat to start when time-sync doesn't succeed, but when
ntpd restarts it should not influence tomcat.

Jan Hugo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210325/132793e8/attachment.htm>


More information about the systemd-devel mailing list