Fix to check if init module is available

Users in Usermin cannot start/restart the service
This commit is contained in:
Ilia
2022-06-02 12:02:34 +03:00
parent 8985485aff
commit bb39025bac

View File

@@ -287,32 +287,34 @@ else {
}
# If there is an init script that runs crond, show status
&foreign_require("init");
my $init = $config{'init_name'};
my $atboot;
if ($access{'stop'} && $init && ($atboot = &init::action_status($init))) {
print &ui_hr();
print &ui_buttons_start();
if (&foreign_available("init")) {
&foreign_require("init");
my $init = $config{'init_name'};
my $atboot;
if ($access{'stop'} && $init && ($atboot = &init::action_status($init))) {
print &ui_hr();
print &ui_buttons_start();
# Running now?
my $r = &init::status_action($init);
if ($r == 1) {
print &ui_buttons_row("stop.cgi", $text{'index_stop'},
$text{'index_stopdesc'});
# Running now?
my $r = &init::status_action($init);
if ($r == 1) {
print &ui_buttons_row("stop.cgi", $text{'index_stop'},
$text{'index_stopdesc'});
}
elsif ($r == 0) {
print &ui_buttons_row("start.cgi", $text{'index_start'},
$text{'index_startdesc'});
}
# Start at boot?
print &ui_buttons_row("bootup.cgi", $text{'index_boot'},
$text{'index_bootdesc'}, undef,
&ui_radio("boot", $atboot == 2 ? 1 : 0,
[ [ 1, $text{'yes'} ],
[ 0, $text{'no'} ] ]));
print &ui_buttons_end();
}
elsif ($r == 0) {
print &ui_buttons_row("start.cgi", $text{'index_start'},
$text{'index_startdesc'});
}
# Start at boot?
print &ui_buttons_row("bootup.cgi", $text{'index_boot'},
$text{'index_bootdesc'}, undef,
&ui_radio("boot", $atboot == 2 ? 1 : 0,
[ [ 1, $text{'yes'} ],
[ 0, $text{'no'} ] ]));
print &ui_buttons_end();
}
&ui_print_footer("/", $text{'index'});