Detect and show unknown status systemd actions https://www.virtualmin.com/node/59115

This commit is contained in:
Jamie Cameron
2018-10-20 10:33:26 -07:00
parent 42f1b789c5
commit 8a684d8c41
4 changed files with 12 additions and 7 deletions

View File

@@ -59,11 +59,13 @@ else {
&ui_yesno_radio("boot", $u->{'boot'}));
}
print &ui_table_row($text{'systemd_status'},
$u->{'status'} && $u->{'pid'} ?
$u->{'status'} == 1 && $u->{'pid'} ?
&text('systemd_status1', $u->{'pid'}) :
$u->{'status'} ?
$u->{'status'} == 1 ?
$text{'systemd_status2'} :
$text{'systemd_status0'});
$u->{'status'} == 0 ?
$text{'systemd_status0'} :
$text{'systemd_status3'});
}
print &ui_table_end();

View File

@@ -361,8 +361,10 @@ elsif ($init_mode eq "systemd" && $access{'bootup'}) {
$u->{'boot'} == 1 ? $text{'yes'} :
$u->{'boot'} == 2 ? $text{'index_always'} :
"<font color=#ff0000>$text{'no'}</font>",
$u->{'status'} ? $text{'yes'} :
"<font color=#ff0000>$text{'no'}</font>",
$u->{'status'} == 1 ? $text{'yes'} :
$u->{'status'} == 0 ?
"<font color=#ff0000>$text{'no'}</font>" :
"<i>$text{'index_unknown'}</i>",
]);
}
print &ui_columns_end();

View File

@@ -2088,7 +2088,7 @@ foreach my $name (keys %info) {
'legacy' => 0,
'boot' => $i->{'UnitFileState'} eq 'enabled' ? 1 :
$i->{'UnitFileState'} eq 'static' ? 2 : 0,
'status' => $i->{'ActiveState'} eq 'active',
'status' => $i->{'ActiveState'} eq 'active' ? 1 : 0,
'start' => $i->{'ExecStart'},
'stop' => $i->{'ExecStop'},
'reload' => $i->{'ExecReload'},
@@ -2113,7 +2113,7 @@ foreach my $a (&list_actions()) {
my $hasarg = &get_action_args($f);
if ($hasarg->{'status'}) {
my $r = &action_running($f);
$s->{'status'} = $r == 1 ? 1 : 0;
$s->{'status'} = $r;
}
push(@rv, $s);
}

View File

@@ -232,6 +232,7 @@ systemd_status=Current status
systemd_status0=Not running
systemd_status1=Running with PID $1
systemd_status2=Running
systemd_status3=Unknown!
systemd_err=Failed to save systemd service
systemd_ename=Missing or invalid-lookup systemd service name
systemd_eclash=A service with the same name already exists