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