[systemd-devel] Using path name in instantiated units

Florian Lindner mailinglists at xgm.de
Tue Aug 19 11:59:55 PDT 2014


Andrei Borzenkov wrote:

> В Tue, 19 Aug 2014 19:34:46 +0200
> Florian Lindner <mailinglists at xgm.de> пишет:
> 
>> 
>> It seems that using %i or %I to set the working directory does not work.
> 
> bor at opensuse:~> sudo systemctl start foo@/home/bor.service
> bor at opensuse:~> cat /tmp/foo
> /home/bor
> %i=-home-bor
> %I=/home/bor
> bor at opensuse:~> cat /run/systemd/system/foo at .service
> [Unit]
> Description=Path %i (%I)
> 
> [Service]
> Type=oneshot
> WorkingDirectory=%I
> ExecStart=/bin/sh -c '/bin/pwd > /tmp/foo; echo %%i=%i >> /tmp/foo; echo
> %%I=%I >> /tmp/foo'

Ok, somehow I obviously got confused while testing. Sorry!

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?

Thx,
Florian



More information about the systemd-devel mailing list