Skip to content

A live bird collage card for your Home Assistant dashboard.

adding stop core services button

Patrick McGuire3ae95ce587c0
diff --git a/scripts/index.html b/scripts/index.html
index 16b861a9..d1375677 100644
--- a/scripts/index.html
+++ b/scripts/index.html
@@ -2,6 +2,10 @@
<input type="submit" value="Edit the birdnet.conf file">
</form>
+<form action="/scripts/stop_core_services.php" onclick="return confirm('Stop core services?')">
+ <input type="submit" value="Stop Core BirdNET-Pi Services">
+</form>
+
<form action="/scripts/restart_services.php" onclick="return confirm('Restart ALL services?')">
<input type="submit" value="Restart ALL BirdNET-Pi Services">
</form>
diff --git a/scripts/stop_core_services.php b/scripts/stop_core_services.php
new file mode 100644
index 00000000..e335b689
--- /dev/null
+++ b/scripts/stop_core_services.php
@@ -0,0 +1,4 @@
+<?php
+shell_exec("/home/pi/BirdNET-Pi/scripts/stop_core_services.sh");
+header('Location: http://birdnetpi.local/scripts/index.html?success=true');
+?>
diff --git a/scripts/stop_core_services.sh b/scripts/stop_core_services.sh
new file mode 100755
index 00000000..2f2c8f4c
--- /dev/null
+++ b/scripts/stop_core_services.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+# Restarts ALL services and removes ALL unprocessed audio
+
+
+services=(birdnet_recording.service
+birdnet_analysis.service
+extraction.timer)
+
+for i in "${services[@]}";do
+ sudo systemctl stop ${i}
+done
+sudo rm -rf ${RECS_DIR}/$(date +%B-%Y/%d-%A)/*
diff --git a/scripts/update_birdnet.php b/scripts/update_birdnet.php
new file mode 100644
index 00000000..ff20b687
--- /dev/null
+++ b/scripts/update_birdnet.php
@@ -0,0 +1,4 @@
+<?php
+shell_exec("sudo -u pi /home/pi/BirdNET-Pi/scripts/update_birdnet.sh > /tmp/phpupdate.log 2&>1");
+header('Location: http://birdnetpi.local/index.html?success=true');
+?>