mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
Fix: rename systemd service, set serviceStatus flag
This commit is contained in:
parent
2b2cb8fa40
commit
5b7b968676
1 changed files with 6 additions and 6 deletions
|
@ -29,21 +29,21 @@ function DisplayRestAPI()
|
|||
}
|
||||
}
|
||||
} elseif (isset($_POST['StartRestAPIservice'])) {
|
||||
$status->addMessage('Attempting to start raspap-restapi.service', 'info');
|
||||
exec('sudo /bin/systemctl start raspap-restapi', $return);
|
||||
$status->addMessage('Attempting to start restapi.service', 'info');
|
||||
exec('sudo /bin/systemctl start restapi.service', $return);
|
||||
foreach ($return as $line) {
|
||||
$status->addMessage($line, 'info');
|
||||
}
|
||||
} elseif (isset($_POST['StopRestAPIservice'])) {
|
||||
$status->addMessage('Attempting to stop raspap-restapi.service', 'info');
|
||||
exec('sudo /bin/systemctl stop raspap-restapi.service', $return);
|
||||
$status->addMessage('Attempting to stop restapi.service', 'info');
|
||||
exec('sudo /bin/systemctl stop restapi.service', $return);
|
||||
foreach ($return as $line) {
|
||||
$status->addMessage($line, 'info');
|
||||
}
|
||||
}
|
||||
}
|
||||
exec('pidof uvicorn | wc -l', $uvicorn);
|
||||
$serviceStatus = $uvicorn[0] == 0 ? "down" : "up";
|
||||
exec("ps aux | grep -v grep | grep uvicorn", $output, $return);
|
||||
$serviceStatus = !empty($output) ? "up" : "down";
|
||||
|
||||
echo renderTemplate("restapi", compact(
|
||||
"status",
|
||||
|
|
Loading…
Reference in a new issue