You are not logged in.
Whenever I enable an instanced systemd service, I want two timers with the same instance specifier to be enabled as well. This is what my unit file foo@.service looks like:
[Unit]
Description=Does something cool
Documentation=man:foo(1)
[Service]
Type=forking
ExecStart=/usr/bin/foo %i
PIDFile=%t/foo/foo.pid
StandardOutput=journal
[Install]
WantedBy=network-online.target
Also=bar1@%i.timer
Also=bar2@%i.timer
Running systemctl enable foo@test.service returns:
Failed to enable unit: Invalid argument
If I remove the instance specifiers from the [Install] section and replace them with specific instance names (so it looks like the following), then it works just fine.
Also=bar1@test.timer
Also=bar2@test.timer
The man page systemd.unit(5) says that the %i specifier is interpreted in the install section, so what gives?
The following specifiers are interpreted in the Install section: %n, %N, %p, %i, %U, %u, %m, %H, %b, %v.
Last edited by thePhysicist8 (2016-08-16 01:31:05)
Offline
This seems to be a bug with the “Also” directive, as “WantedBy” happily takes %i
Offline
Do you think that this could be a bug with systemd (even one specific to my setup), or is this the intended behavior?
Offline
Before I posted, I tried this on my system and I got the same as you. I also tried “WantedBy” which did work. You'd expect “Also” to work from reading the systemd.unit man page.
If something is not working as documented, that's a bug.
Offline