Skip to content

A live bird collage card for your Home Assistant dashboard.

fixing clear_all_data errors

mcguirepr89834ea5e49a6a
diff --git a/scripts/clear_all_data.sh b/scripts/clear_all_data.sh
index c26df1bf..68e089d4 100755
--- a/scripts/clear_all_data.sh
+++ b/scripts/clear_all_data.sh
@@ -24,7 +24,7 @@ echo "Creating necessary directories"
sudo -u ${USER} ln -fs $(dirname ${my_dir})/homepage/* ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname ${my_dir})/model/labels.txt ${my_dir}/
-sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED}
+sudo -u ${USER} ln -fs $(dirname ${my_dir}) ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/play.php ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/overview.php ${EXTRACTED}
@@ -37,10 +37,10 @@ sudo -u ${USER} ln -fs $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/php
sudo -u ${USER} ln -fs $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/
sudo -u ${USER} ln -fs $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html
sudo chmod -R g+rw $(dirname ${my_dir})
-sudo chmod -R g+rw ${RECS_DIR}
+sudo chmod -R g+rw ${EXTRACTED}
echo "Dropping and re-creating database"
-sudo /home/pi/BirdNET-Pi/scripts/createdb.sh
+createdb.sh
echo "Restarting services"
sudo systemctl start birdnet_server.service
sudo systemctl start birdnet_analysis.service
diff --git a/scripts/createdb.sh b/scripts/createdb.sh
index bfeece3b..8f2e230d 100755
--- a/scripts/createdb.sh
+++ b/scripts/createdb.sh
@@ -1,11 +1,5 @@
#!/usr/bin/env bash
-# This script performs the mysql_secure_installation
-# Creates the birds database
-# Creates the detections table
-# Creates the birder user and grants them appropriate
-# permissions
-# If using this script to re-initialize (DROP then CREATE)
-# the DB, be sure to run this as root or with sudo
+set -x
source /etc/birdnet/birdnet.conf
sqlite3 /home/pi/BirdNET-Pi/scripts/birds.db << EOF
DROP TABLE IF EXISTS detections;
diff --git a/scripts/system_controls.php b/scripts/system_controls.php
index cff40b36..7e05fcb4 100644
--- a/scripts/system_controls.php
+++ b/scripts/system_controls.php
@@ -14,6 +14,6 @@
<button type="submit" name="submit" value="sudo shutdown now" onclick="return confirm('Are you sure you want to shutdown?')">Shutdown</button>
</form>
<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="sudo -upi clear_all_data.sh" onclick="return confirm('Clear ALL Data? This cannot be undone.')">Clear ALL data</button>
</form>
</div>