diff options
Diffstat (limited to 'phosphor-rsyslog-config/utils.hpp')
-rw-r--r-- | phosphor-rsyslog-config/utils.hpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/phosphor-rsyslog-config/utils.hpp b/phosphor-rsyslog-config/utils.hpp new file mode 100644 index 0000000..ea7984d --- /dev/null +++ b/phosphor-rsyslog-config/utils.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "config.h" +#include <sdbusplus/bus.hpp> + +namespace phosphor +{ +namespace rsyslog_utils +{ + +/** @brief Restart rsyslog's systemd unit + */ +void restart() +{ + auto bus = sdbusplus::bus::new_default(); + auto method = bus.new_method_call( + SYSTEMD_BUSNAME, + SYSTEMD_PATH, + SYSTEMD_INTERFACE, + "RestartUnit"); + method.append("rsyslog.service", "replace"); + bus.call_noreply(method); +} + +} // namespace rsyslog_utils +} // namespace phosphor |