xref: /openbmc/phosphor-logging/phosphor-rsyslog-config/utils.hpp (revision c49661925b0c59a4355aca6813a85d749c21e764)
1*c4966192SDeepak Kodihalli #pragma once
2*c4966192SDeepak Kodihalli 
3*c4966192SDeepak Kodihalli #include "config.h"
4*c4966192SDeepak Kodihalli #include <sdbusplus/bus.hpp>
5*c4966192SDeepak Kodihalli 
6*c4966192SDeepak Kodihalli namespace phosphor
7*c4966192SDeepak Kodihalli {
8*c4966192SDeepak Kodihalli namespace rsyslog_utils
9*c4966192SDeepak Kodihalli {
10*c4966192SDeepak Kodihalli 
11*c4966192SDeepak Kodihalli /** @brief Restart rsyslog's systemd unit
12*c4966192SDeepak Kodihalli  */
13*c4966192SDeepak Kodihalli void restart()
14*c4966192SDeepak Kodihalli {
15*c4966192SDeepak Kodihalli     auto bus = sdbusplus::bus::new_default();
16*c4966192SDeepak Kodihalli     auto method = bus.new_method_call(
17*c4966192SDeepak Kodihalli                       SYSTEMD_BUSNAME,
18*c4966192SDeepak Kodihalli                       SYSTEMD_PATH,
19*c4966192SDeepak Kodihalli                       SYSTEMD_INTERFACE,
20*c4966192SDeepak Kodihalli                       "RestartUnit");
21*c4966192SDeepak Kodihalli     method.append("rsyslog.service", "replace");
22*c4966192SDeepak Kodihalli     bus.call_noreply(method);
23*c4966192SDeepak Kodihalli }
24*c4966192SDeepak Kodihalli 
25*c4966192SDeepak Kodihalli } // namespace rsyslog_utils
26*c4966192SDeepak Kodihalli } // namespace phosphor
27