chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
manager: print fatal errors on the console too
[elogind.git]
/
src
/
core
/
failure-action.c
diff --git
a/src/core/failure-action.c
b/src/core/failure-action.c
index 941747429f8b3468fa3f36f0fce5649d0d00cbd1..ce522a4e4fee33244a80004c8b333f39f1da1594 100644
(file)
--- a/
src/core/failure-action.c
+++ b/
src/core/failure-action.c
@@
-29,6
+29,13
@@
#include "special.h"
#include "failure-action.h"
#include "special.h"
#include "failure-action.h"
+static void log_and_status(Manager *m, const char *message) {
+ log_warning("%s", message);
+ manager_status_printf(m, STATUS_TYPE_EMERGENCY,
+ ANSI_HIGHLIGHT_RED_ON " !! " ANSI_HIGHLIGHT_OFF,
+ "%s", message);
+}
+
int failure_action(
Manager *m,
FailureAction action,
int failure_action(
Manager *m,
FailureAction action,
@@
-57,7
+64,7
@@
int failure_action(
case FAILURE_ACTION_REBOOT: {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
case FAILURE_ACTION_REBOOT: {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- log_
warning(
"Rebooting as result of failure.");
+ log_
and_status(m,
"Rebooting as result of failure.");
update_reboot_param_file(reboot_arg);
r = manager_add_job_by_name(m, JOB_START, SPECIAL_REBOOT_TARGET, JOB_REPLACE, true, &error, NULL);
update_reboot_param_file(reboot_arg);
r = manager_add_job_by_name(m, JOB_START, SPECIAL_REBOOT_TARGET, JOB_REPLACE, true, &error, NULL);
@@
-68,13
+75,14
@@
int failure_action(
}
case FAILURE_ACTION_REBOOT_FORCE:
}
case FAILURE_ACTION_REBOOT_FORCE:
- log_warning("Forcibly rebooting as result of failure.");
+ log_and_status(m, "Forcibly rebooting as result of failure.");
+
update_reboot_param_file(reboot_arg);
m->exit_code = MANAGER_REBOOT;
break;
case FAILURE_ACTION_REBOOT_IMMEDIATE:
update_reboot_param_file(reboot_arg);
m->exit_code = MANAGER_REBOOT;
break;
case FAILURE_ACTION_REBOOT_IMMEDIATE:
- log_
warning(
"Rebooting immediately as result of failure.");
+ log_
and_status(m,
"Rebooting immediately as result of failure.");
sync();
sync();
@@
-90,7
+98,7
@@
int failure_action(
case FAILURE_ACTION_POWEROFF: {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
case FAILURE_ACTION_POWEROFF: {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- log_
warning(
"Powering off as result of failure.");
+ log_
and_status(m,
"Powering off as result of failure.");
r = manager_add_job_by_name(m, JOB_START, SPECIAL_POWEROFF_TARGET, JOB_REPLACE, true, &error, NULL);
if (r < 0)
r = manager_add_job_by_name(m, JOB_START, SPECIAL_POWEROFF_TARGET, JOB_REPLACE, true, &error, NULL);
if (r < 0)
@@
-100,12
+108,12
@@
int failure_action(
}
case FAILURE_ACTION_POWEROFF_FORCE:
}
case FAILURE_ACTION_POWEROFF_FORCE:
- log_
warning(
"Forcibly powering off as result of failure.");
+ log_
and_status(m,
"Forcibly powering off as result of failure.");
m->exit_code = MANAGER_POWEROFF;
break;
case FAILURE_ACTION_POWEROFF_IMMEDIATE:
m->exit_code = MANAGER_POWEROFF;
break;
case FAILURE_ACTION_POWEROFF_IMMEDIATE:
- log_
warning(
"Powering off immediately as result of failure.");
+ log_
and_status(m,
"Powering off immediately as result of failure.");
sync();
sync();