[systemd-devel] EnvironmentFile generated during ExecStartPre phase

微蔡 microcai at fedoraproject.org
Wed Oct 31 08:07:42 PDT 2012


On Wednesday 31 October 2012 16:46:55 Mantas Mikulėnas wrote:
> On Wed, Oct 31, 2012 at 3:28 PM, Honza Horak 
<hhorak at redhat.com> wrote:
> > My use case is the following: the service should be started with 
some
> > environment variables defined, but the variable values are not 
static, but
> > rather dynamically generated using some script. This could be 
solved by
> > using EnvironmentFile=-/var/run/myservice, while this file would 
be
> > generated in ExecStartPre=/usr/libexec/myservice-gen-env.
> 
> This could also be solved by using the script directly as ExecStart,
> and having it `exec` the real service (possibly `exec "$@"`) as its
> last step. That way, you wouldn't need to actually generate a file
> (just `export` the variables before exec'ing) or rely on specific
> execution order.

if you have socket activation, systemd passed socket have   close-on-
exec flag set.  thus you can't exec real server in scripts.

-- 
 ______________ 
< gentoo rocks >
 -------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20121031/3a23bf3c/attachment.pgp>


More information about the systemd-devel mailing list