Is it possible to tell my unit file to wait for any instance (unknown instance name) of a template unit file?
Something like this: After=template@*.service
Example:
I have this template file ([email protected]):
[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 file (other.service):
[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 unit only to run when at least 1 instance of [email protected] is running
You have to make the instantiated unit part of a custom target.. then require the target in other.service.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With