blob: 30799cd43cf0968082639c7014388e289920f757 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#pragma once
#include "config.h"
#include <sdbusplus/bus.hpp>
namespace phosphor
{
namespace rsyslog_utils
{
/** @brief Restart rsyslog's systemd unit
* Ensures that it is restarted even if the start limit was
* hit in systemd.
*/
void restart()
{
auto bus = sdbusplus::bus::new_default();
constexpr char service[] = "rsyslog.service";
{
auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
SYSTEMD_INTERFACE, "ResetFailedUnit");
method.append(service);
bus.call_noreply(method);
}
{
auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
SYSTEMD_INTERFACE, "RestartUnit");
method.append(service);
bus.call_noreply(method);
}
}
} // namespace rsyslog_utils
} // namespace phosphor
|