removing unneeded scripts and adding extractions to logging

This commit is contained in:
mcguirepr89
2022-02-15 13:48:05 -05:00
parent 443b8984f1
commit 073e718cac
22 changed files with 42 additions and 130 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
journalctl --no-hostname -o short -fu birdnet_analysis -u birdnet_server | sed "s/$(date "+%b %d ")//g"
journalctl --no-hostname -o short -fu birdnet_analysis -ubirdnet_server -uextraction | sed "s/$(date "+%b %d ")//g"
-4
View File
@@ -1,4 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/clear_all_data.sh");
header('Location: /viewdb.php');
?>
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Exit when any command fails
set -x
#set -x
set -e
# Keep track of the last executed command
#trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
-3
View File
@@ -1,3 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/reboot_system.sh");
?>
-2
View File
@@ -1,2 +0,0 @@
#!/usr/bin/env bash
sudo reboot
-7
View File
@@ -1,7 +0,0 @@
#!/usr/bin/env bash
# Reconfigure the BirdNET-Pi
source /etc/birdnet/birdnet.conf
uninstall.sh
${HOME}/BirdNET-Pi/scripts/install_config.sh
USER=${USER} HOME=${HOME} sudo ${HOME}/BirdNET-Pi/scripts/install_services.sh
echo "BirdNET-Pi has now been reconfigured."
-55
View File
@@ -1,55 +0,0 @@
#!/usr/bin/bash
# Writes variables to config file
set -x
birdnetpi_dir=/home/pi/BirdNET-Pi
source ${birdnetpi_dir}/scripts/welcome_wizard.sh
birdnet_conf=${birdnetpi_dir}/birdnet.conf
rearview() {
zenity --title="Configuration Complete!!" --width=300 --ok-label="Finished" --window-icon=/usr/share/pixmaps/red-cardinal32.png \
--info --text="
Caddy is reloading and the passwords are being updated.
When the system is updated with your new information,
the main web page will open automatically" --no-wrap --icon-name=red-cardinal
}
rearview &
if ! [ -z ${new_lat} ];then
sed -i s/'^LATITUDE=.*'/"LATITUDE=${new_lat}"/g ${birdnet_conf}
fi
if ! [ -z ${new_lon} ];then
sed -i s/'^LONGITUDE=.*'/"LONGITUDE=${new_lon}"/g ${birdnet_conf}
fi
if ! [ -z ${caddy_pwd} ];then
sed -i s/'^CADDY_PWD=.*'/"CADDY_PWD=${caddy_pwd}"/g ${birdnet_conf}
hash_pwd=$(caddy hash-password -plaintext ${caddy_pwd})
sudo sed -i s/'birdnet\ .*'/"birdnet ${hash_pwd}"/g /etc/caddy/Caddyfile
sudo systemctl reload caddy
fi
if ! [ -z ${db_pwd} ];then
sed -i s/'^DB_PWD=.*'/"DB_PWD=${db_pwd}"/g ${birdnet_conf}
${birdnetpi_dir}/scripts/update_db_pwd_bullseye.sh
fi
if ! [ -z ${birdnetpi_url} ];then
sed -i s/'^BIRDNETPI_URL=.*'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
sed -i s/'^WEBTERMINAL_URL=.*'/"WEBTERMINAL_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
sed -i s/'^BIRDNETLOG_URL=.*'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
fi
if ! [ -z ${new_sensitivity} ];then
sed -i s/'^SENSITIVITY=.*'/"SENSITIVITY=${new_sensitivity}"/g ${birdnet_conf}
fi
if ! [ -z ${new_confidence} ];then
sed -i s/'^CONFIDENCE=.*'/"CONFIDENCE=${new_confidence}"/g ${birdnet_conf}
fi
${birdnetpi_dir}/scripts/update_birdnet.sh
sudo apt install -y --reinstall icecast2
xdg-open http://birdnetpi.local
systemctl --user disable birdnet-pi-welcome-wizard.service
-4
View File
@@ -1,4 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/restart_birdnet_analysis.sh");
header("Location: /overview.php");
?>
-3
View File
@@ -1,3 +0,0 @@
#!/usr/bin/env bash
# Restars the main BirdNET analysis service
sudo systemctl restart birdnet_analysis.service
-4
View File
@@ -1,4 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/restart_birdnet_recording.sh");
header('Location: /viewdb.php');
?>
-3
View File
@@ -1,3 +0,0 @@
#!/usr/bin/env bash
# Restars the BirdNET Recording service
sudo systemctl restart birdnet_recording.service
-4
View File
@@ -1,4 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/restart_caddy.sh");
header('Location: /viewdb.php');
?>
-3
View File
@@ -1,3 +0,0 @@
#!/usr/bin/env bash
# Restars the caddy webserver
sudo systemctl restart caddy
-4
View File
@@ -1,4 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/restart_extraction.sh");
header('Location: http://birdnetpi.local:8888');
?>
-3
View File
@@ -1,3 +0,0 @@
#!/usr/bin/env bash
# Restars the BirdNET Extraction service
sudo systemctl restart extraction.service
-4
View File
@@ -1,4 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/restart_services.sh");
header('Location: http://birdnetpi.local:8080');
?>
+23 -8
View File
@@ -59,24 +59,39 @@ a {
<body style="background-color: rgb(119, 196, 135);">
<div class="row">
<div class="column first">
<form action="/scripts/stop_core_services.php" onclick="return confirm('Stop core services?')">
<form action="" method="POST" onclick="return confirm('Stop core services?')">
<input type="hidden" name="submit" value="stop_core_services.sh">
<button type="submit" class="block">Stop Core Services</button>
</form>
<form action="/scripts/restart_services.php" onclick="return confirm('Restart ALL services?')">
<form action="" method="POST" onclick="return confirm('Restart ALL services?')">
<input type="hidden" name="submit" value="restart_services.sh">
<button type="submit" class="block">Restart ALL Services</button>
</form>
<form action="/scripts/restart_birdnet_analysis.php">
<form action="" method="POST">
<input type="hidden" name="submit" value="sudo systemctl restart birdnet_analysis.service">
<button type="submit" class="block">Restart BirdNET Analysis</button>
</form>
<form action="/scripts/restart_birdnet_recording.php">
<form action="" method="POST">
<input type="hidden" name="submit" value="sudo systemctl restart birdnet_recording.service">
<button type="submit" class="block">Restart Recording</button>
</form>
<form action="/scripts/restart_extraction.php">
<button type="submit" class="block">Restart Extraction</button>
</form>
<form action="/scripts/restart_caddy.php" onclick="return confirm('Restart Caddy? You will be disconnected for about 20 seconds.')">
<form action="" method="POST" onclick="return confirm('Restart Caddy? You will be disconnected for about 20 seconds.')">
<input type="hidden" name="submit" value="sudo systemctl restart caddy">
<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'];
echo "<h3>Executed $command</h3>";
shell_exec("$command");
}
?>
</div>
</div>
</body>
-3
View File
@@ -1,3 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/shutdown_system.sh");
?>
-2
View File
@@ -1,2 +0,0 @@
#!/usr/bin/env bash
sudo shutdown now
-4
View File
@@ -1,4 +0,0 @@
<?php
shell_exec("/home/pi/BirdNET-Pi/scripts/stop_core_services.sh");
header('Location: /overview.php');
?>
+17 -4
View File
@@ -59,17 +59,30 @@ a {
<body style="background-color: rgb(119, 196, 135);">
<div class="row">
<div class="column first">
<form action="/scripts/reboot_system.php" onclick="return confirm('Are you sure you want to reboot?')">
<form action="" method="POST" onclick="return confirm('Are you sure you want to reboot?')">
<input type="hidden" name="submit" value="sudo reboot">
<button type="submit" class="block">Reboot</button>
</form>
<form action="/scripts/update_birdnet.php" onclick="return confirm('BE SURE TO STASH ANY LOCAL CHANGES YOU HAVE MADE TO THE SYSTEM BEFORE UPDATING!!!')">
<form action="" method="POST" onclick="return confirm('BE SURE TO STASH ANY LOCAL CHANGES YOU HAVE MADE TO THE SYSTEM BEFORE UPDATING!!!')">
<input type="hidden" name="submit" value="update_birdnet.sh">
<button style="color:blue;" type="submit" class="block">Update</button>
</form>
<form action="/scripts/shutdown_system.php" onclick="return confirm('Are you sure you want to shutdown?')">
<form action="" method="POST" onclick="return confirm('Are you sure you want to shutdown?')">
<input type="hidden" name="submit" value="sudo shutdown now">
<button style="color: red;" type="submit" class="block">Shutdown</button>
</form>
<form action="/scripts/clear_all_data.php" onclick="return confirm('Clear ALL Data? This cannot be undone.')">
<form action="" method="POST" onclick="return confirm('Clear ALL Data? This cannot be undone.')">
<input type="hidden" name="submit" value="clear_all_data.sh">
<button style="color: red;" type="submit" class="block">Clear ALL data</button>
</form>
</div>
<div class="column second">
<?php
if(isset($_POST['submit'])){
$command = $_POST['submit'];
echo "<h3>Executing $command</h3>";
shell_exec("$command");
}
?>
</div>
</body>
-4
View File
@@ -1,4 +0,0 @@
<?php
shell_exec("sudo -u pi /home/pi/BirdNET-Pi/scripts/update_birdnet.sh > /tmp/phpupdate.log 2&>1");
header('Location: update_inprogress.php');
?>