Re: [HEADS-UP] systemd for F14 - the next steps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ons 2010-07-14 klockan 20:54 +0200 skrev Lennart Poettering:
> On Wed, 14.07.10 13:31, Chris Adams (cmadams@xxxxxxxxxx) wrote:

> > Once upon a time, Lennart Poettering <mzerqung@xxxxxxxxxxx> said:

> > >   ExecStartPre=-/bin/mkdir -p /var/run/foo ; -/sbin/restorecon /var/run/foo

> > Why would you ignore the exit code?  If you can't make the directory and
> > set the context, you shouldn't start the service.
> 
> Well, dunno, maybe if SELinux is disabled via selinux=0 restorcon fails?

Nah, please don't hide errors like that. It just makes things harder to
debug.

It could be done properly in a shell command but ExecStartPre probably
doesn't take a shell command, just arguments for exec(), so you'd have
to do "ExecStartPre=bash -c 'blahblah....'". Anyway, we're trying to
avoid starting a shell for every daemon.

The solution is to rewrite it in C code and have a "RunDir=/var/run/foo"
option in the unit file which creates the directory and calls restorecon
if necessary. For complicated cases where a shell command really is
needed you can use the bash -c trick or put the command in a shell
script file and just specify
"ExecStartPre=/usr/share/foo/daemon-startpre.sh".

> The default is of course to check all return values, i.e. you have to
> explicitly prefix the commands with "-" to ignore them.

Is this feature really necessary? I think it would be best to avoid
using it...

/Alexander


-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux