1

I am trying to figure out how to specify dynamic dependencies for systemd that are specific to the current instance@. In the [Service] section I can use EnvironmentFile= to load in variables using the %i variable, but I don't see any such thing for the [Unit] section.

Is there a way to load dependencies dynamically for specific units?

2
  • 2
    This is a very strange request. What is your use case here? Aug 9, 2014 at 13:39
  • We have a software running that can run in several rolls, eg. master, worker, scheduler, etc. These roles are determined through configuration files. I would like to run these using systemd and have the configuration specified through a %i symlink, but I need to ensure that they start in the proper order: master < scheduler < worker.
    – Marcus
    Aug 10, 2014 at 14:45

1 Answer 1

1

Also the [Unit] section allows specifiers like %i (see systemd.unit(5))

[email protected]:

[Unit]
Description=the daemon
Requires=other-daemon@%i.service
After=other-daemon@%i.service
[Service]
#....
2
  • Don't you mean other-daemon@%i.service? Aug 31, 2014 at 22:13
  • other-daemon-%i.service would theoretically works too, but other-daemon@%i.service makes more sense in this context.
    – Mic92
    Sep 10, 2014 at 20:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .