[! use strict; use PVE::I18N; use PVE::ConfigServer; use PVE::HTMLTable; use PVE::HTMLDropDown; use PVE::HTMLUtils; !] [- use strict; my $out = ''; my @header = ( '1', '20px', ' ', '1', '100px', __('Service'), '1', '100px', __('State'), '1', '100px', __('Autostart'), '1', '400px', __('Description') ); my $table = PVE::HTMLTable->new ([]); $table->add_headline (\@header); my $ddown = PVE::HTMLDropDown->new (); $ddown->add_item("item","?action=startservice", __("Start") ); $ddown->add_item("item","?action=stopservice", __("Stop") ); $ddown->add_item("item","?action=restartservice", __("Restart") ); $ddown->add_item("apache","?action=restartservice", __("Restart") ); my $conn = PVE::ConfigClient::connect (); if ($udat{action}) { eval { check_write_mode ($udat{AM}); if ($udat{action} eq 'restartservice') { if ($fdat{service} eq 'apache') { eval { $conn->service_cmd ($fdat{service}, 'restart'); }; } else { $conn->service_cmd ($fdat{service}, 'restart'); } } elsif ($udat{action} eq 'startservice') { $conn->service_cmd ($fdat{service}, 'start'); } elsif ($udat{action} eq 'stopservice') { $conn->service_cmd ($fdat{service}, 'stop'); } }; if ($@) { $udat{popup_error} = $@; $udat{redirect} = $fdat{__uri}; return; } } my $states = $conn->service_state_all ()->result; $out .= "
"; if ($udat{AM} eq 'w') { $out .= "";
$out .= " " . __("Restart Server") . "
";
$out .= " " . __("Shutdown Server") . "";
$out .= "