Require any template instance

Can I tell my device file to wait for any instance (name of an unknown instance) of the template file?

Something like this: After = template @ *. service

Example:

I have this template file (template @ .service):

[Unit] Description=TemplateFile After=network.target [Service] Type=idle ExecStart=/bin/sh -c '${JBOSS_HOME}/bin/standalone.sh ${JBOSS_START_OPTS}' ExecStop=/bin/sh -c '${JBOSS_HOME}/bin/jboss-cli.sh ${JBOSS_STOP_OPTS}' [Install] WantedBy=multi-user.target 

And I have this unit (other.service) file:

 [Unit] Description=Other After=network.target # Requires=template@ [a-zA-Z0-9]*.service [Service] Type=idle Environment=DISPLAY=:0 ExecStart=/usr/bin/gedit RemainAfterExit=yes [Install] WantedBy=multi-user.target 

I want the other.service module to start only when at least one instance of the @ .service template is started

+5
source share
1 answer

You need to create an instance part of the custom target part .. then the target in other.service is required.

+1
source

Source: https://habr.com/ru/post/1246446/


All Articles