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