[systemd-devel] machinectl status vs show

Lennart Poettering lennart at poettering.net
Wed Jun 17 14:09:54 PDT 2015


On Wed, 17.06.15 13:34, Johannes Ernst (johannes.ernst at gmail.com) wrote:

> In which case:
> 
> 1. The man pages, to me, imply that I should be able to get everything that ‘status' shows using ‘show' because it says:
> 
> "This function is intended to generate human-readable output. If you are looking for computer-parsable output, use show instead.” (and vice versa)
> 
> This sentence may need a revision.

Added to the TODO list

> 
> 2. So how do I get at the IP address of the container in a way that
> is easily parseable?

make sure "nss-mymachines" is installed and enabled (see its man page
for details). With that in place the container name is resolvable
using normal libc calls, i.e. "ping <containername>" will work then,
and all other commands too.

Use "getent hosts foobar" to resolve hostnames from the command line,
in a generic, parsable way. It will then work both for containers as
well as for any other kind of host name.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list