[systemd-devel] Using path name in instantiated units
Andrei Borzenkov
arvidjaar at gmail.com
Tue Aug 19 11:07:32 PDT 2014
В 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'
> When I do systemctl --user start git-commit@/home/florian/timer.test.service
> the journal prints:
>
> Aug 19 18:43:01 asaru systemd[375]: Starting Auto commit for instance....
> Aug 19 18:43:01 asaru git[4761]: fatal: Not a git repository (or any of the
> parent directories): .git
> Aug 19 18:43:01 asaru systemd[375]: git-commit at -home-florian-
> timer.test.service: main process exited, code=exited, status=128/n/a
> Aug 19 18:43:01 asaru systemd[375]: Failed to start Auto commit for
> instance..
> Aug 19 18:43:01 asaru systemd[375]: Unit git-commit at -home-florian-
> timer.test.service entered failed state.
>
>
> and wd (created in ~) contains
> -home-florian-timer.test
> -home-florian-timer.test
> /home/florian
>
> Any ideas how I can change the working directory to the directory given by
> the instance name?
> Thx!
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
More information about the systemd-devel
mailing list