system: unify mvc and legacy cron restart

So both sides don't miss the other.  Remove $defer since
we can simply start it later anyway.
This commit is contained in:
Franco Fichtner 2021-11-16 14:39:21 +01:00
parent 7fe7c460b0
commit d319644859
5 changed files with 7 additions and 11 deletions

View File

@ -100,8 +100,10 @@ function core_services()
$services[] = array(
'description' => gettext('Cron'),
'php' => array(
"restart" => array('system_cron_configure')
'start' => ['system_cron_configure'],
'restart' => ['system_cron_configure'],
),
'pidfile' => '/var/run/cron.pid',
'name' => 'cron',
);

View File

@ -872,7 +872,7 @@ function system_devd_configure($verbose = false)
}
}
function system_cron_configure($verbose = false, $defer = false)
function system_cron_configure($verbose = false)
{
function generate_cron_job($command, $minute = '0', $hour = '*', $monthday = '*', $month = '*', $weekday = '*')
{
@ -931,9 +931,7 @@ function system_cron_configure($verbose = false, $defer = false)
configd_run('template reload OPNsense/Cron');
if (!$defer) {
configd_run('cron restart');
}
mwexec('/etc/rc.d/cron restart');
if ($verbose) {
echo "done.\n";

View File

@ -100,7 +100,6 @@ interfaces_configure(true);
system_resolvconf_generate(true);
filter_configure_sync(true);
plugins_configure('early', true);
system_cron_configure(true, true);
system_routing_configure(true);
system_hosts_generate(true);

View File

@ -53,10 +53,7 @@ class ServiceController extends ApiControllerBase
$backend = new Backend();
// generate template
$backend->configdRun('template reload OPNsense/Cron');
// (res)start daemon
// generate configuration and (re)start daemon
$backend->configdRun("cron restart");
return array("status" => "ok");

View File

@ -1,5 +1,5 @@
[restart]
command:/etc/rc.d/cron restart
command:pluginctl -s cron restart
parameters:
type:script
message:restarting cron