api/services: fallback to restart in reload

And document that it is preferred

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-07-24 13:55:57 +02:00
parent cae3d32732
commit 9f0a47d9c3

View File

@ -319,7 +319,7 @@ __PACKAGE__->register_method ({
name => 'service_restart',
path => '{service}/restart',
method => 'POST',
description => "Restart service.",
description => "Hard restart service. Use reload if you want to reduce interruptions.",
permissions => {
check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
},
@ -355,7 +355,7 @@ __PACKAGE__->register_method ({
name => 'service_reload',
path => '{service}/reload',
method => 'POST',
description => "Reload service.",
description => "Reload service. Falls back to restart if service cannot be reloaded.",
permissions => {
check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
},
@ -381,7 +381,7 @@ __PACKAGE__->register_method ({
my $upid = shift;
syslog('info', "reloading service $param->{service}: $upid\n");
$service_cmd->($param->{service}, 'reload');
$service_cmd->($param->{service}, 'try-reload-or-restart');
};