"replace");
if (ret < 0)
log_error_errno(ret, "Failed to restart service: %s", service_path);
+ else
+ log_kmsg("Restarting service: %s", service_path);
unref_old_event:
faultd_event_unref(ev);
};
FAULTD_ACTION_REGISTER_SIMPLE(service_restart_action);
-
#include "action.h"
#include "action_executor.h"
#include "decision_made_event.h"
+#include "service_failed_event.h"
+#include "resource_violation_event.h"
#include "log.h"
#include "systemd_dbus.h"
static int reboot_system(struct faultd_action *action)
{
struct faultd_event *ev = pop_faultd_event(&action->execution_queue);
+ struct decision_made_event *dm_ev = to_decision_made_event(ev);
+ struct service_failed_event *sf_ev = NULL;
+ struct resource_violation_event *rv_ev = NULL;
int ret;
+ if (faultd_event_is_of_type(dm_ev->reason,
+ SERVICE_FAILED_EVENT_ID)) {
+
+ sf_ev = to_service_failed_event(dm_ev->reason);
+ log_kmsg("Trying to reboot the system (reason: %s)",
+ sf_ev->service.dbus_path);
+
+ } else if (faultd_event_is_of_type(dm_ev->reason,
+ RESOURCE_VIOLATION_EVENT_ID)) {
+
+ rv_ev = to_resource_violation_event(dm_ev->reason);
+ log_kmsg("Trying to reboot the system (reason: %s)",
+ rv_ev->service.dbus_path);
+
+ } else {
+ log_kmsg("Trying to reboot the system");
+ }
+
/*
* We reboot the system without using logind because this action may be
* executed when for example dbus daemon is dead