adding service controls

This commit is contained in:
mcguirepr89
2022-03-08 10:08:59 -05:00
parent 98d5bcfe59
commit 419b9da314
4 changed files with 87 additions and 136 deletions
+4 -4
View File
@@ -286,11 +286,11 @@ button:hover {
float: left; float: left;
} }
.systemcontrols form { .systemcontrols form,.servicecontrols form {
text-align: center; text-align: center;
} }
.systemcontrols button { .systemcontrols button,.servicecontrols button {
border: 2px solid black; border: 2px solid black;
background-color: rgb(219, 255, 235); background-color: rgb(219, 255, 235);
padding: 12px; padding: 12px;
@@ -302,7 +302,7 @@ body::-webkit-scrollbar {
} }
@media screen and (max-width: 1000px) { @media screen and (max-width: 1000px) {
.systemcontrols button{ .systemcontrols button,.servicecontrols button {
width: 60%; width: 60%;
padding: 12px; padding: 12px;
background-color: rgb(219, 255, 235); background-color: rgb(219, 255, 235);
@@ -350,7 +350,7 @@ body::-webkit-scrollbar {
} }
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
.systemcontrols button{ .systemcontrols button,.servicecontrols button {
width: 80%; width: 80%;
padding: 12px; padding: 12px;
background-color: rgb(219, 255, 235); background-color: rgb(219, 255, 235);
+2
View File
@@ -34,6 +34,7 @@
if(isset($_POST['view'])){ if(isset($_POST['view'])){
if($_POST['view'] == "System Info"){header('location:phpsysinfo/index.php');} if($_POST['view'] == "System Info"){header('location:phpsysinfo/index.php');}
if($_POST['view'] == "System Controls"){include('scripts/system_controls.php');} if($_POST['view'] == "System Controls"){include('scripts/system_controls.php');}
if($_POST['view'] == "Services"){include('scripts/service_controls.php');}
if($_POST['view'] == "Spectrogram"){include('spectrogram.php');} if($_POST['view'] == "Spectrogram"){include('spectrogram.php');}
if($_POST['view'] == "Overview"){include('overview.php');} if($_POST['view'] == "Overview"){include('overview.php');}
if($_POST['view'] == "Today's Detections"){include('viewdb.php');} if($_POST['view'] == "Today's Detections"){include('viewdb.php');}
@@ -61,6 +62,7 @@ if(isset($_POST['view'])){
<button type=\"submit\" name=\"view\" value=\"Settings\" form=\"views\">Settings</button> <button type=\"submit\" name=\"view\" value=\"Settings\" form=\"views\">Settings</button>
<button type=\"submit\" name=\"view\" value=\"System Info\" form=\"views\">System Info</button> <button type=\"submit\" name=\"view\" value=\"System Info\" form=\"views\">System Info</button>
<button type=\"submit\" name=\"view\" value=\"System Controls\" form=\"views\">System Controls</button> <button type=\"submit\" name=\"view\" value=\"System Controls\" form=\"views\">System Controls</button>
<button type=\"submit\" name=\"view\" value=\"Services\" form=\"views\">Services</button>
<button type=\"submit\" name=\"view\" value=\"File\" form=\"views\">File Manager</button> <button type=\"submit\" name=\"view\" value=\"File\" form=\"views\">File Manager</button>
<a href=\"scripts/adminer.php\" target=\"_top\"><button type=\"submit\" form=\"\">Database Maintenanace</button></a> <a href=\"scripts/adminer.php\" target=\"_top\"><button type=\"submit\" form=\"\">Database Maintenanace</button></a>
<button type=\"submit\" name=\"view\" value=\"Webterm\" form=\"views\">Web Terminal</button> <button type=\"submit\" name=\"view\" value=\"Webterm\" form=\"views\">Web Terminal</button>
+79 -106
View File
@@ -1,107 +1,80 @@
<html>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<style> <link rel="stylesheet" href="../style.css">
* { <br>
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT', <br>
' Calibri', 'Trebuchet MS', 'sans-serif'; <div class="servicecontrols">
box-sizing: border-box; <form action="" method="POST">
<h3>Live Audio Stream</h3>
box-sizing: border-box; <button type="submit" name="submit" value="sudo systemctl stop livestream.service">Stop</button>
} <button type="submit" name="submit" value="sudo systemctl restart livestream.service">Restart </button>
<button type="submit" name="submit" value="sudo systemctl disable --now livestream.service">Disable</button>
/* Create two unequal columns that floats next to each other */ <button type="submit" name="submit" value="sudo systemctl enable --now livestream.service">Enable</button>
.column { </form>
float: left; <form action="" method="POST">
padding: 10px; <h3>Web Terminal</h3>
} <button type="submit" name="submit" value="sudo systemctl stop web_terminal.service">Stop</button>
<button type="submit" name="submit" value="sudo systemctl restart web_terminal.service">Restart </button>
.first { <button type="submit" name="submit" value="sudo systemctl disable --now web_terminal.service">Disable</button>
width: calc(50% - 70px); <button type="submit" name="submit" value="sudo systemctl enable --now web_terminal.service">Enable</button>
} </form>
<form action="" method="POST">
.second { <h3>BirdNET Log</h3>
width: calc(50% - 30px); <button type="submit" name="submit" value="sudo systemctl stop birdnet_log.service">Stop</button>
} <button type="submit" name="submit" value="sudo systemctl restart birdnet_log.service">Restart </button>
<button type="submit" name="submit" value="sudo systemctl disable --now birdnet_log.service">Disable</button>
/* Clear floats after the columns */ <button type="submit" name="submit" value="sudo systemctl enable --now birdnet_log.service">Enable</button>
.row:after { </form>
content: ""; <form action="" method="POST">
display: table; <h3>Extraction Service</h3>
clear: both; <button type="submit" name="submit" value="sudo systemctl stop extraction.service">Stop</button>
} <button type="submit" name="submit" value="sudo systemctl restart extraction.service">Restart </button>
body { <button type="submit" name="submit" value="sudo systemctl disable --now extraction.service">Disable</button>
background-color: rgb(119, 196, 135); <button type="submit" name="submit" value="sudo systemctl enable --now extraction.service">Enable</button>
} </form>
<form action="" method="POST">
a { <h3>BirdNET Analysis Server</h3>
text-decoration: none; <button type="submit" name="submit" value="sudo systemctl stop birdnet_server.service">Stop</button>
color: white; <button type="submit" name="submit" value="sudo systemctl restart birdnet_server.service">Restart</button>
} <button type="submit" name="submit" value="sudo systemctl disable --now birdnet_server.service">Disable</button>
<button type="submit" name="submit" value="sudo systemctl enable --now birdnet_server.service">Enable</button>
.block { </form>
display: block; <form action="" method="POST">
font-weight: bold; <h3>BirdNET Analysis Client</h3>
width:100%; <button type="submit" name="submit" value="sudo systemctl stop birdnet_analysis.service">Stop</button>
border: none; <button type="submit" name="submit" value="sudo systemctl restart birdnet_analysis.service">Restart</button>
background-color: #04AA6D; <button type="submit" name="submit" value="sudo systemctl disable --now birdnet_analysis.service">Disable</button>
padding: 20px 20px; <button type="submit" name="submit" value="sudo systemctl enable --now birdnet_analysis.service">Enable</button>
color: white; </form>
font-size: medium; <form action="" method="POST">
cursor: pointer; <h3>Recording Service</h3>
text-align: center; <button type="submit" name="submit" value="sudo systemctl stop birdnet_recording.service">Stop</button>
} <button type="submit" name="submit" value="sudo systemctl restart birdnet_recording.service">Restart</button>
@media screen and (max-width: 800px) { <button type="submit" name="submit" value="sudo systemctl disable --now birdnet_recording.service">Disable</button>
.column { <button type="submit" name="submit" value="sudo systemctl enable --now birdnet_recording.service">Enable</button>
float: none; </form>
width: 100%; <form action="" method="POST">
} <h3>Chart Viewer</h3>
} <button type="submit" name="submit" value="sudo systemctl stop chart_viewer.service">Stop</button>
</style> <button type="submit" name="submit" value="sudo systemctl restart chart_viewer.service">Restart</button>
<body style="background-color: rgb(119, 196, 135);"> <button type="submit" name="submit" value="sudo systemctl disable --now chart_viewer.service">Disable</button>
<div class="row"> <button type="submit" name="submit" value="sudo systemctl enable --now chart_viewer.service">Enable</button>
<div class="column first"> </form>
<form action="" method="POST" onclick="return confirm('Stop core services?')"> <form action="" method="POST">
<input type="hidden" name="submit" value="stop_core_services.sh"> <h3>Spectrogram Viewer</h3>
<button type="submit" class="block">Stop Core Services</button> <button type="submit" name="submit" value="sudo systemctl stop spectrogram_viewer.service">Stop</button>
</form> <button type="submit" name="submit" value="sudo systemctl restart spectrogram_viewer.service">Restart</button>
<form action="" method="POST" onclick="return confirm('Restart ALL services?')"> <button type="submit" name="submit" value="sudo systemctl disable --now spectrogram_viewer.service">Disable</button>
<input type="hidden" name="submit" value="restart_services.sh"> <button type="submit" name="submit" value="sudo systemctl enable --now spectrogram_viewer.service">Enable</button>
<button type="submit" class="block">Restart ALL Services</button> </form>
</form> <form action="" method="POST">
<form action="" method="POST"> <h3>Pushed Notifications</h3>
<input type="hidden" name="submit" value="sudo systemctl restart birdnet_analysis.service"> <button type="submit" name="submit" value="sudo systemctl stop pushed_notifications.service">Stop</button>
<button type="submit" class="block">Restart BirdNET Analysis</button> <button type="submit" name="submit" value="sudo systemctl restart pushed_notifications.service">Restart</button>
</form> <button type="submit" name="submit" value="sudo systemctl disable --now pushed_notifications.service">Disable</button>
<form action="" method="POST"> <button type="submit" name="submit" value="sudo systemctl enable --now pushed_notifications.service">Enable</button>
<input type="hidden" name="submit" value="sudo systemctl restart birdnet_recording.service"> </form>
<button type="submit" class="block">Restart Recording</button> <form action="" method="POST">
</form> <button type="submit" name="submit" value="restart_services.sh" onclick="return confirm('This will take about 90 seconds.')">Restart All Services</button>
<form action="" method="POST" onclick="return confirm('Restart Caddy? You will be disconnected for about 20 seconds.')"> </form>
<input type="hidden" name="submit" value="sudo systemctl restart caddy"> </div>
<button type="submit" class="block">Restart Caddy</button>
</form>
</div>
<div class="column second">
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['submit'])){
$command = $_POST['submit'];
if($command == 'restart_services.sh'){
$str= "<h3>Restarting Services</h3>
<p>Please wait 60-90 seconds</p>";
echo str_pad($str, 4096);
ob_flush();
flush();
}
if(isset($command)){
$results = shell_exec("$command 2>&1");
echo "<pre>$results</pre>";
}
}
ob_end_flush();
?>
</div>
</div>
</body>
+2 -26
View File
@@ -1,29 +1,8 @@
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if(isset($_POST['submit'])){
$command = $_POST['submit'];
if($command == 'update_birdnet.sh'){
$str= "<h3>Updating . . . </h3>
<p>Please wait 60 seconds</p>";
echo str_pad($str, 4096);
ob_flush();
flush();
}
if(isset($command)){
$results = shell_exec("$command 2>&1");
echo "</div>
</div>
<pre>$results</pre>";
}
}
ob_end_flush();
?>
<html> <html>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../style.css"> <link rel="stylesheet" href="../style.css">
<br>
<br>
<div class="systemcontrols"> <div class="systemcontrols">
<form action="" method="POST"> <form action="" method="POST">
<button type="submit" name="submit" value="sudo reboot" onclick="return confirm('Are you sure you want to reboot?')">Reboot</button> <button type="submit" name="submit" value="sudo reboot" onclick="return confirm('Are you sure you want to reboot?')">Reboot</button>
@@ -37,7 +16,4 @@ ob_end_flush();
<form action="" method="POST"> <form action="" method="POST">
<button type="submit" name="submit" value="clear_all_data.sh" onclick="return confirm('Clear ALL Data? This cannot be undone.')">Clear ALL data</button> <button type="submit" name="submit" value="clear_all_data.sh" onclick="return confirm('Clear ALL Data? This cannot be undone.')">Clear ALL data</button>
</form> </form>
<form action="" method="POST">
<button type="submit" name="submit" value="">Test</button>
</form>
</div> </div>