[systemd-devel] Using path name in instantiated units

Lennart Poettering lennart at poettering.net
Tue Aug 19 13:54:04 PDT 2014


On Tue, 19.08.14 19:34, Florian Lindner (mailinglists at xgm.de) wrote:

> Hello,
> I have a systemd unit that should do a commit on a specific path. Since 
> there are more then one path / repos, I want to use an instantiated unit for 
> that (the stuff with @ in the unit name):
> 
> 
> ~/.config/systemd/user % cat git-commit at .service
> [Unit]
> Description=Auto commit for instance.
> 
> [Service]
> Type = oneshot
> Nice = 10
> 
> # git returns 1 if there is nothing to commit
> SuccessExitStatus=1
> 
> WorkingDirectory = %I  # also tried %i
> ExecStart = /usr/bin/sh -c 'echo %i > wd'
> ExecStart = /usr/bin/sh -c 'echo %i >> wd'
> ExecStart = /usr/bin/sh -c 'echo `pwd` >> wd'
> ExecStart = /usr/bin/git add --all .
> ExecStart = /usr/bin/git commit -a -m "Automatic commit."

Use "%f" for unescaping paths.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list