Does systemd expose any unit-file-parsing functionality?

Lennart Poettering mzerqung at 0pointer.de
Wed Mar 21 23:45:43 UTC 2012


On Sat, 17.03.12 11:41, Tom Lane (tgl at redhat.com) wrote:

> Tomasz Torcz <tomek at pipebreaker.pl> writes:
> > On Sat, Mar 17, 2012 at 10:32:22AM -0400, Tom Lane wrote:
> >> I have a shell script that needs to dig the values of a couple of
> >> "Environment=" settings out of a systemd service file.  Currently
> >> it just assumes it knows the search path for such things, finds
> >> the file, and greps for the right lines.  This seems unduly friendly
> >> with the file format, and it was just pointed out to me that it
> >> completely fails to handle .include directives.  So I'm wondering if
> >> there is anything in the systemd infrastructure that could help me
> >> do this in a more robust way.  Ideas anyone?
> 
> >   You can try
> >  systemctl show -p Environment <unit>
> 
> [ experiments with that ... ]  Hm, the output format seems pretty
> ill-designed, but I guess I can pick it apart with some careful
> sed'ing.  Better than trying to handle .include for myself, anyway.
> Thanks for the suggestion!

Hmm, what are you mising in the output format? We are always interested
in suggestions for imprvoement.

Note that this command will not show you the environment inherited by
the PID 1 or any other env that is passed on that is not explicitly
configured in the unit files.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the devel mailing list