[systemd-devel] [PATCH] systemctl: add "systemctl cat"

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sat Nov 30 19:45:10 PST 2013


On Sat, Nov 30, 2013 at 04:09:26PM -0800, Shawn Landden wrote:
> ---
>  TODO                      |   2 -
>  man/systemctl.xml         |   9 ++++
>  src/shared/fileio.c       |  73 ++++++++++++++++++++++++++++++-
>  src/shared/fileio.h       |   1 +
>  src/shared/util.c         |   2 +
>  src/systemctl/systemctl.c | 107 ++++++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 191 insertions(+), 3 deletions(-)
> 
> diff --git a/TODO b/TODO
> index 6ba4b31..7c6003b 100644
> --- a/TODO
> +++ b/TODO
> @@ -125,8 +125,6 @@ Features:
>  
>  * optimize the cgroup propagation bits, especially unit_get_members_mask(), cgroup_context_get_mask()
>  
> -* "systemctl cat" or "systemctl view" command or or so, that cats the backing unit file of a service, plus its drop-ins and shows them in a pager
> -
Hi Shawn,
applied, I think this willl prove to be useful tool. 

I removed the part that shows the SourcePath. E.g. with mount units
generated from /proc/self/mountinfo most of the lines shown
are irrelevant. I think it would be nice to teach systemd about the
line/lines in SourcePath that the unit comes from, and then say that
"this unit was generated based on ...". Nevertheless, I don't think it
ever makes sense to show the contents of SourcePath, since it doesn't
"mix" with the rest of the output, since it is in a different format.

Also, when the unit doesn't exist, nothing is printed, and no error is
shown, and return value is 0.  This doesn't seem to be correct, I
think that a check if the unit is actually known to systemd should be
added. Since we can have units without any source whatsoever, the
lack of fragment path/drop-ins cannot be considered a good enough
indication. I'm not sure what's the best way to implement this check.

Zbyszek


More information about the systemd-devel mailing list