Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 1 | #include <attn_logging.hpp> |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 2 | #include <sdbusplus/bus.hpp> |
| 3 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 4 | namespace attn |
| 5 | { |
| 6 | |
| 7 | /** @brief Start host diagnostic mode systemd unit */ |
| 8 | void tiHandler() |
| 9 | { |
| 10 | // trace message |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 11 | trace<level::INFO>("start host diagnostic mode service"); |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 12 | |
| 13 | // Use the systemd service manager object interface to call the start unit |
| 14 | // method with the obmc-host-diagnostic-mode target. |
| 15 | auto bus = sdbusplus::bus::new_system(); |
| 16 | auto method = bus.new_method_call( |
| 17 | "org.freedesktop.systemd1", "/org/freedesktop/systemd1", |
| 18 | "org.freedesktop.systemd1.Manager", "StartUnit"); |
| 19 | |
| 20 | method.append("obmc-host-diagnostic-mode@0.target"); // unit to activate |
| 21 | method.append("replace"); // mode = replace conflicting queued jobs |
| 22 | bus.call_noreply(method); // start the service |
| 23 | |
| 24 | return; |
| 25 | } |
| 26 | |
| 27 | } // namespace attn |