update snippets for birdnet_analysis.py
This commit is contained in:
@@ -20,7 +20,7 @@ install_depends() {
|
|||||||
apt install -qqy caddy ftpd sqlite3 php-sqlite3 alsa-utils \
|
apt install -qqy caddy ftpd sqlite3 php-sqlite3 alsa-utils \
|
||||||
pulseaudio avahi-utils sox libsox-fmt-mp3 php php-fpm php-curl php-xml \
|
pulseaudio avahi-utils sox libsox-fmt-mp3 php php-fpm php-curl php-xml \
|
||||||
php-zip icecast2 swig ffmpeg wget unzip curl cmake make bc libjpeg-dev \
|
php-zip icecast2 swig ffmpeg wget unzip curl cmake make bc libjpeg-dev \
|
||||||
zlib1g-dev python3-dev python3-pip python3-venv lsof net-tools
|
zlib1g-dev python3-dev python3-pip python3-venv lsof net-tools gcc python3-dev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -43,15 +43,12 @@ install_birdnet_analysis() {
|
|||||||
cat << EOF > $HOME/BirdNET-Pi/templates/birdnet_analysis.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/birdnet_analysis.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET Analysis
|
Description=BirdNET Analysis
|
||||||
After=birdnet_server.service
|
|
||||||
Requires=birdnet_server.service
|
|
||||||
[Service]
|
[Service]
|
||||||
RuntimeMaxSec=900
|
|
||||||
Restart=always
|
Restart=always
|
||||||
Type=simple
|
Type=simple
|
||||||
RestartSec=2
|
RestartSec=2
|
||||||
User=${USER}
|
User=${USER}
|
||||||
ExecStart=/usr/local/bin/birdnet_analysis.sh
|
ExecStart=$PYTHON_VIRTUAL_ENV /usr/local/bin/birdnet_analysis.py
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -55,10 +55,30 @@ ensure_python_package() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# update snippets below
|
# update snippets below
|
||||||
|
if ! which inotifywait &>/dev/null;then
|
||||||
|
ensure_apt_updated
|
||||||
|
apt-get -y install inotify-tools
|
||||||
|
fi
|
||||||
|
if ! which gcc &>/dev/null;then
|
||||||
|
ensure_apt_updated
|
||||||
|
apt-get -y install gcc python3-dev
|
||||||
|
fi
|
||||||
|
|
||||||
|
ensure_python_package inotify inotify
|
||||||
|
|
||||||
if ! grep 'daemon' $HOME/BirdNET-Pi/templates/chart_viewer.service &>/dev/null;then
|
if ! grep 'daemon' $HOME/BirdNET-Pi/templates/chart_viewer.service &>/dev/null;then
|
||||||
sed -i "s|daily_plot.py.*|daily_plot.py --daemon --sleep 2|" ~/BirdNET-Pi/templates/chart_viewer.service
|
sed -i "s|daily_plot.py.*|daily_plot.py --daemon --sleep 2|" ~/BirdNET-Pi/templates/chart_viewer.service
|
||||||
systemctl daemon-reload && restart_services.sh
|
systemctl daemon-reload && restart_services.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if grep -q 'birdnet_server.service' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"&>/dev/null; then
|
||||||
|
sed -i '/After=.*/d' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"
|
||||||
|
sed -i '/Requires=.*/d' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"
|
||||||
|
sed -i '/RuntimeMaxSec=.*/d' "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"
|
||||||
|
sed -i "s|ExecStart=.*|ExecStart=$HOME/BirdNET-Pi/birdnet/bin/python3 /usr/local/bin/birdnet_analysis.py|" "$HOME/BirdNET-Pi/templates/birdnet_analysis.service"
|
||||||
|
systemctl daemon-reload && restart_services.sh
|
||||||
|
fi
|
||||||
|
|
||||||
# update snippets above
|
# update snippets above
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|||||||
Reference in New Issue
Block a user