blob: 4d9acd90e680001a370a912c666c09e30ffb6275 [file] [log] [blame]
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05001#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
8namespace watchdog
9{
10namespace dump
11{
12
13using namespace phosphor::logging;
14
15void 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
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050031} // namespace dump
32} // namespace watchdog