[systemd-devel] Using path name in instantiated units

Florian Lindner mailinglists at xgm.de
Wed Aug 20 01:25:35 PDT 2014


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?
 
>> This was my latter idea, creating a target and set WantedBy=that.target
>> in the services [Install] section. Not?
>> 
> 
> Yes (it may be any unit, not necessarily target).




More information about the systemd-devel mailing list