[systemd-devel] [PATCH 2/4] manager: also show the warning on the console

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sat Oct 25 12:43:25 PDT 2014


---
 src/core/manager.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/core/manager.c b/src/core/manager.c
index 7917afdbb1..770a6b55e2 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -111,11 +111,17 @@ static int manager_log_running_jobs(Manager *m) {
                 if (!strv)
                         return log_oom();
 
+                manager_status_printf(m, false, NULL,
+                                      "Active jobs (%u running):", m->n_running_jobs);
+
                 HASHMAP_FOREACH(j, m->jobs, it) {
                         strv[i] = strjoin(j->unit->id, "/", job_type_to_string(j->type),
                                           "/", job_state_to_string(j->state), NULL);
                         if (!strv[i])
                                 return log_oom();
+
+                        manager_status_printf(m, false, NULL,
+                                              "\t%s", strv[i]);
                         i++;
                 }
                 strv[i] = NULL;
@@ -125,8 +131,11 @@ static int manager_log_running_jobs(Manager *m) {
                         return log_oom();
 
                 log_info("Active jobs (%u running):\n\t%s.", m->n_running_jobs, all);
-        } else
-                log_info("No jobs seem to be running.");
+        } else {
+                manager_status_printf(m, false, NULL,
+                                      "No jobs seem to be active.");
+                log_info("No jobs seem to be active.");
+        }
 
         return 0;
 }
@@ -1060,6 +1069,9 @@ static int on_start_timeout(sd_event_source *s, usec_t usec, void *userdata) {
         assert(m);
 
         if (!m->start_timeout_warned) {
+                manager_status_printf(m, false,
+                                      ANSI_HIGHLIGHT_YELLOW_ON "  !!  " ANSI_HIGHLIGHT_OFF,
+                                      "2/3 of the start timeout have passed.");
                 log_warning("2/3 of the start timeout have passed.");
                 m->start_timeout_warned = true;
 
@@ -1079,7 +1091,13 @@ static int on_start_timeout(sd_event_source *s, usec_t usec, void *userdata) {
 
         m->start_timeout_event_source = sd_event_source_unref(m->start_timeout_event_source);
 
-        log_error("Startup timed out, performing %s%s%s.",
+        manager_status_printf(m, false,
+                              ANSI_HIGHLIGHT_RED_ON " !!  " ANSI_HIGHLIGHT_OFF,
+                              "Startup timed out, performing %s%s%s.",
+                              failure_action_to_string(m->start_timeout_action),
+                              m->start_timeout_reboot_arg ? "/" : "",
+                              strempty(m->start_timeout_reboot_arg));
+        log_error("Startup timed out, %s%s%s action pending.",
                   failure_action_to_string(m->start_timeout_action),
                   m->start_timeout_reboot_arg ? "/" : "",
                   strempty(m->start_timeout_reboot_arg));
-- 
1.9.3



More information about the systemd-devel mailing list