system: straighten out syslog-ng rc.d scripting

Make sure that 'pluginctl -s xxx stop' isn't used here as it
does not stop a disabled instance.  The point is moot for
syslog-ng since you cannot disable it but that only leaves
a tiny amount of daemons that still use it in core (nothing
in plugins uses it).

Also consolidate away from service(8) since we expect and
call the rc.d script directly.
This commit is contained in:
Franco Fichtner 2025-02-18 13:50:08 +01:00
parent 2842e1bee7
commit caf8d65b28
3 changed files with 13 additions and 16 deletions

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2018-2022 Deciso B.V.
* Copyright (C) 2018-2025 Deciso B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -108,16 +108,18 @@ function core_services()
'name' => 'cron',
);
$services[] = array(
$services[] = [
'description' => gettext('Syslog-ng Daemon'),
'php' => array(
'stop' => array('system_syslog_stop'),
'start' => array('system_syslog_start'),
'restart' => array('system_syslog_start')
),
'php' => [
'start' => ['system_syslog_start'],
'restart' => ['system_syslog_start'],
],
'configd' => [
'stop' => ['syslog stop'],
],
'pidfile' => '/var/run/syslog-ng.pid',
'name' => 'syslog-ng',
);
];
return $services;
}

View File

@ -818,7 +818,7 @@ function system_syslog_start($verbose = false)
if (isvalidpid('/var/run/syslog-ng.pid') && $last_version == $this_version) {
mwexecf('/usr/local/sbin/syslog-ng-ctl reload');
} else {
mwexecf('/usr/sbin/service syslog-ng restart');
mwexecf('/usr/local/etc/rc.d/syslog-ng restart');
}
file_put_contents('/var/run/syslog-ng.version', $this_version);
@ -826,11 +826,6 @@ function system_syslog_start($verbose = false)
service_log("done.\n", $verbose);
}
function system_syslog_stop()
{
mwexecf('/usr/sbin/service syslog-ng stop');
}
function system_syslog_reset($verbose = false)
{
$it = new RecursiveDirectoryIterator('/var/log');

View File

@ -12,7 +12,7 @@ type:script
message:Starting syslog
[stop]
command:/usr/local/sbin/pluginctl -s syslog-ng stop
command:/usr/local/etc/rc.d/syslog-ng stop
parameters:
type:script
message:Stopping syslog
@ -31,7 +31,7 @@ type:script
message:Reload syslog
[status]
command:/usr/local/etc/rc.d/syslog-ng status;exit 0
command:/usr/local/etc/rc.d/syslog-ng status; exit 0
parameters:
type:script_output
message:Request syslog status