[systemd-devel] Shell expressions in EnvironmentFile

Damien Robert damien.olivier.robert+gmane at gmail.com
Wed Oct 8 11:07:45 PDT 2014


Lennart Poettering  wrote in message
<20141008094838.GB26284 at gardel-login>:
> On Tue, 07.10.14 19:18, Simon Peeters (peeters.simon at gmail.com) wrote:
>> ExecStart=/bin/sh -c ". /something/that/sets/var; /some/file $var"
> THis would certainly work, but I'd strongly advise to use "exec" for
> executing /some/file at the end, so that the shell process is replaced
> by the actual daemon process, instead of continuing running with the
> demon process as child.

I am hijacking the thread because one minor inconvenience I have with sh -c
'exec foo' is that in journalctl the logging refers to 'sh':
For instance:

[Unit]
Description=Git backup
ConditionPathIsDirectory=%h/backups/gitbackup

[Service]
Type=simple
ExecStart=/bin/sh -c 'exec %h/mine/script/gitbackup -v save'
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7

gives me the log:

Oct 08 21:35:43 mithrim sh[9680]: [master 54c23ae]
Oct 08 21:35:43 mithrim sh[9680]: 2 files changed, 3 insertions(+), 3 deletions(-)
 
Do you know of any way to get 'gitbackup' in the log rather than 'sh'?



More information about the systemd-devel mailing list