- if (my $restart = $ENV{RESTART_PVE_DAEMON}) {
- $self->start();
- } else {
- my ($running, $pid) = $self->running();
- if (!$running) {
- $self->start();
- } else {
- kill(1, $pid);
- }
- }
+ &$reload_daemon($self, $use_hup);
+
+ return undef;
+ }});
+}
+
+sub register_reload_command {
+ my ($self, $class, $description) = @_;
+
+ $class->register_method({
+ name => 'reload',
+ path => 'reload',
+ method => 'POST',
+ description => $description || "Reload daemon configuration (or start if not running).",
+ parameters => {
+ additionalProperties => 0,
+ properties => {},
+ },
+ returns => { type => 'null' },
+
+ code => sub {
+ my ($param) = @_;
+
+ &$reload_daemon($self, 1);