1 #include <libpdbg.h> 2 3 #include <phosphor-logging/log.hpp> 4 #include <sdbusplus/bus.hpp> 5 #include <watchdog_common.hpp> 6 #include <watchdog_logging.hpp> 7 8 #include <map> 9 10 namespace watchdog 11 { 12 namespace dump 13 { 14 15 using namespace phosphor::logging; 16 17 void transitionHost(const std::string& target) 18 { 19 constexpr auto systemdService = "org.freedesktop.systemd1"; 20 constexpr auto systemdObjPath = "/org/freedesktop/systemd1"; 21 constexpr auto systemdInterface = "org.freedesktop.systemd1.Manager"; 22 23 auto bus = sdbusplus::bus::new_system(); 24 auto method = bus.new_method_call(systemdService, systemdObjPath, 25 systemdInterface, "StartUnit"); 26 27 method.append(target); // target unit to start 28 method.append("replace"); 29 30 bus.call_noreply(method); // start the service 31 } 32 33 } // namespace dump 34 } // namespace watchdog 35