blob: dd7d2345d8b0d88e9186b44a634efc9773df04f4 [file] [log] [blame]
Jayanth Othayoth5ba35c62025-06-07 03:55:11 -05001#include "watchdog_common.hpp"
2
3#include "watchdog_logging.hpp"
4
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05005#include <phosphor-logging/log.hpp>
6#include <sdbusplus/bus.hpp>
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05007
8#include <map>
9
10namespace watchdog
11{
12namespace dump
13{
14
15using namespace phosphor::logging;
16
17void 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
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050033} // namespace dump
34} // namespace watchdog