summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-23 17:04:43 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-29 21:55:51 +0200
commit94f099d8132da7987a5dbe930dadf31aaded9a11 (patch)
tree55ac5bf23000aa149f905f0614398ea2a0eb84a6 /src
parent16f98462a0bfd10862e73582a8ad70288d39132f (diff)
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...
Diffstat (limited to 'src')
-rw-r--r--src/systemctl/systemctl.c6
1 files changed, 6 insertions, 0 deletions
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",