From dd01423e916380ead7cf4e72f749d3e081133e40 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Mon, 17 Jun 2019 13:36:17 +0200 Subject: [PATCH] Syslog-NG, restart both syslog daemons on service restarts to avoid communication issues. Since both services (syslog-ng, syslog) have their own status its good to show them separately, for proper functionality they should however be treated as one. Add a stop action to prevent service stop from only stopping the service named "syslog". --- src/etc/inc/plugins.inc.d/core.inc | 7 ++++--- src/etc/inc/system.inc | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/etc/inc/plugins.inc.d/core.inc b/src/etc/inc/plugins.inc.d/core.inc index fab9d946d..4564eee60 100644 --- a/src/etc/inc/plugins.inc.d/core.inc +++ b/src/etc/inc/plugins.inc.d/core.inc @@ -82,6 +82,7 @@ function core_services() $services[] = array( 'description' => gettext('Local Syslog'), 'php' => array( + "stop" => array('system_syslogd_stop'), "start" => array('system_syslogd_start'), "restart" => array('system_syslogd_start') ), @@ -92,9 +93,9 @@ function core_services() $services[] = array( 'description' => gettext('Remote Syslog'), 'mwexec' => array( - 'restart' => array('/usr/local/etc/rc.d/syslog-ng restart'), - 'start' => array('/usr/local/etc/rc.d/syslog-ng start'), - 'stop' => array('/usr/local/etc/rc.d/syslog-ng stop'), + "stop" => array('system_syslogd_stop'), + "start" => array('system_syslogd_start'), + "restart" => array('system_syslogd_start') ), 'pidfile' => '/var/run/syslog-ng.pid', 'name' => 'syslog-ng', diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 611c092f5..49409824e 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -657,6 +657,15 @@ EOD; } } +/** + * stop syslog + syslog-ng + */ +function system_syslogd_stop() +{ + killbypid('/var/run/syslog.pid', 'TERM', true); + mwexecf("/usr/sbin/service syslog-ng stop"); +} + function system_clear_log($logfile, $restart_syslogd = true) { if ($restart_syslogd) {