[systemd-devel] Using path name in instantiated units

Florian Lindner mailinglists at xgm.de
Wed Aug 20 01:45:00 PDT 2014


Florian Lindner wrote:

> Andrei Borzenkov wrote:
> 
>> В Tue, 19 Aug 2014 22:08:26 +0200
>> Florian Lindner <mailinglists at xgm.de> пишет:
>> 
>>> Andrei Borzenkov wrote:
>>> 
>>> > В Tue, 19 Aug 2014 20:59:55 +0200
>>> > Florian Lindner <mailinglists at xgm.de> пишет:
>>> > 
>>> >> 
>>> >> I also try to set up a matching timer:
>>> >> 
>>> >> systemctl --user start git-commit@/home/florian/timer.test.timer
>>> >> 
>>> >> works fine, but:
>>> >> 
>>> >> systemctl --user enable git-commit@/home/florian/timer.test.timer
>>> >> Failed to execute operation: Invalid argument
>>> >> 
>>> >> Or is creating a target for the timer and set WantedBy in the service
>>> >> file the way to go? But still, why is starting working, but not
>>> >> enabling?
>>> >> 
>>> > 
>>> > Does your unit have [Install] section?
>>> 
>>> No.
>>> 
>> 
>> "systemctl enable" creates links listed in [Install] section; how do
>> expect it to work in this case?
> 
> The timer I try to enable contains a Install section.
> 
> 
> florian at asaru ~/.config/systemd/user % cat git-commit at .timer
> [Unit]
> Description=Timer to commit all changes in instance.
> 
> [Timer]
> OnUnitActiveSec=5min
> OnActiveSec=5min
> AccuracySec = 5min
> 
> [Install]
> WantedBy=default.target
> florian at asaru ~/.config/systemd/user % systemctl --user enable git-
> commit@/home/florian/timer.test.timer
> Failed to execute operation: Invalid argument
> 
> 
> Is my assumption that instance argument (the path) is derived from the
> timer to the unit wrong?

I was expecting that the timer unit A at B.timer calls the service unit 
A at B.service. It seems to work fine with path units, as proposed by Anthony.


Enabling a A at .timer works fine, but A at B.timer fails with the error message 
above. A Install section is present (btw, systemd gives a more verbose error 
message if a Install section is missing on enable).

Curious, while systemctl --user enable git-commit at .timer gives no error 
message and zero return code, it does not place a link in 
default.target.wants...


Sorry for my confusion...!




More information about the systemd-devel mailing list