From 94f099d8132da7987a5dbe930dadf31aaded9a11 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 23 Sep 2015 17:04:43 +0200 Subject: systemctl: make "systemctl is-system-running" return "offline" if we are not booted with systemd This sounds like the better place to expose this than in "systemd-notify --booted". Also document the so far undocumented "unknown" state the command might return. And rearrange the table of states documented to be more like the one for "is-running". Also, don't document the precise exit code of this function, just say errors are reported != 0 or > 0... --- src/systemctl/systemctl.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/systemctl') diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 56c7982b8f..2b9de5d016 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -5753,6 +5753,12 @@ static int is_system_running(sd_bus *bus, char **args) { _cleanup_free_ char *state = NULL; int r; + if (arg_transport == BUS_TRANSPORT_LOCAL && !sd_booted()) { + if (!arg_quiet) + puts("offline"); + return EXIT_FAILURE; + } + r = sd_bus_get_property_string( bus, "org.freedesktop.systemd1", -- cgit v1.2.3-54-g00ecf