Automatic Update Feature (#424)

* Update advanced.php

Added a checkbox in the Advanced Settings page to enable Automatic Update

* Update install_config.sh

The AUTOMATIC_UPDATE parameter needs to be created in the BirdNET-Pi configuration file.

* Update install_services.sh

Add a cron job to the system to performa automatic updates.

* Create automatic_update.cron

The line to be added to the cron table to check for need to perform automatic update.

* Create automatic_update.sh

Script to perform the automatic update if the flag is set in the configuration.  Also, the services are restarted after the update.

* Update install_services.sh

* Update automatic_update.sh

* Update advanced.php

Correct typo

* Update update_birdnet_snippets.sh

Add the automatic_update.cron to the list of cron jobs

* Update update_birdnet_snippets.sh

* Update automatic_update.cron

Change automatic update to once a week on Sunday at 3AM

* Update update_birdnet_snippets.sh

Adjusted to add option to existing installations

* Update automatic_update.sh

Removed unnecessary call to restart_services.sh

* Update advanced.php

Cleaned up the Options section line spacing in the settings table

* Update templates/automatic_update.cron

Co-authored-by: Nachtzuster <Nachtzuster@users.noreply.github.com>

* Update scripts/update_birdnet_snippets.sh

Co-authored-by: Nachtzuster <Nachtzuster@users.noreply.github.com>

* Delete scripts/automatic_update.sh

* Update advanced.php

Modified the description of the Automatic Update feature on the Advanced Configuration tab.

* Update install_config.sh

---------

Co-authored-by: Nachtzuster <Nachtzuster@users.noreply.github.com>
This commit is contained in:
dalogue1
2025-09-24 13:06:48 -05:00
committed by GitHub
parent adef45f741
commit 786348d815
5 changed files with 41 additions and 7 deletions
+6 -1
View File
@@ -114,6 +114,10 @@ if ! grep -E '^MAX_FILES_SPECIES=' /etc/birdnet/birdnet.conf &>/dev/null;then
echo "MAX_FILES_SPECIES=\"0\"" >> /etc/birdnet/birdnet.conf
fi
if ! grep -E '^AUTOMATIC_UPDATE=' /etc/birdnet/birdnet.conf &>/dev/null;then
echo "AUTOMATIC_UPDATE=0" >> /etc/birdnet/birdnet.conf
fi
if ! grep -E '^RARE_SPECIES_THRESHOLD=' /etc/birdnet/birdnet.conf &>/dev/null;then
echo '## RARE_SPECIES_THRESHOLD defines after how many days a species is considered as rare and highlighted on overview page' >> /etc/birdnet/birdnet.conf
echo "RARE_SPECIES_THRESHOLD=\"30\"" >> /etc/birdnet/birdnet.conf
@@ -235,10 +239,11 @@ if [ -L /usr/local/bin/birdnet_analysis.sh ];then
fi
# Clean state and update cron if all scripts are not installed
if [ "$(grep -o "#birdnet" /etc/crontab | wc -l)" -lt 5 ]; then
if [ "$(grep -o "#birdnet" /etc/crontab | wc -l)" -lt 6 ]; then
sudo sed -i '/birdnet/,+1d' /etc/crontab
sed "s/\$USER/$USER/g" "$HOME"/BirdNET-Pi/templates/cleanup.cron >> /etc/crontab
sed "s/\$USER/$USER/g" "$HOME"/BirdNET-Pi/templates/weekly_report.cron >> /etc/crontab
sed "s/\$USER/$USER/g" "$HOME"/BirdNET-Pi/templates/automatic_update.cron >> /etc/crontab
fi
set +x