[systemd-devel] How to modify files from within systemd *.service? (for example using /bin/echo and stdout redirection)

Peter Lemenkov lemenkov at gmail.com
Sat May 26 00:38:49 PDT 2012


Hello!

2012/5/26 Joachim <joachim.banzhaf at googlemail.com>:
> It doesnt work because redirects are a shell feature and systemd starts
> programs without the help of a shell. So this line
>
> ExecStart=/bin/echo 2 > /tmp/test.txt
>
> would need to be transformed into
>
> ExecStart=/bin/bash -c 'echo 2 > /tmp/test.txt'
>
> untested, but should work.


Thanks - this indeed works. I just tested it.

-- 
With best regards, Peter Lemenkov.


More information about the systemd-devel mailing list