fixing restart_services

This commit is contained in:
mcguirepr89
2022-02-16 07:19:26 -05:00
parent 4863a2eef7
commit 64295bece0
5 changed files with 15 additions and 10 deletions
+3 -1
View File
@@ -320,7 +320,9 @@ run_birdnet() {
run_analysis "${1}"
}
date
until grep 5050 <(netstat -tulpn 2>&1) &> /dev/null 2>&1;do
sleep 1
done
if [ $(find ${RECS_DIR} -maxdepth 1 -name '*wav' | wc -l) -gt 0 ];then
run_birdnet "${RECS_DIR}"
+1 -1
View File
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
journalctl --no-hostname -o short -fu birdnet_analysis -ubirdnet_server -uextraction | sed "s/$(date "+%b %d ")//g"
journalctl --no-hostname -q -o short -fu birdnet_analysis -ubirdnet_server -uextraction | sed "s/$(date "+%b %d ")//g"
+1 -1
View File
@@ -5,7 +5,7 @@ echo 'zram' | sudo tee /etc/modules-load.d/zram.conf
sudo touch /etc/modprobe.d/zram.conf
echo 'options zram num_devices=1' | sudo tee /etc/modprobe.d/zram.conf
sudo touch /etc/udev/rules.d/99-zram.rules
echo 'KERNEL=="zram0", ATTR{disksize}="4G",TAG+="systemd"' \
echo 'KERNEL=="zram0", ATTR{disksize}="2G",TAG+="systemd"' \
| sudo tee /etc/udev/rules.d/99-zram.rules
sudo touch /etc/systemd/system/zram.service
echo "Installing zram.service"
+8 -4
View File
@@ -4,6 +4,8 @@ source /etc/birdnet/birdnet.conf
set -x
my_dir=/home/pi/BirdNET-Pi/scripts
sudo systemctl stop birdnet_server.service
sudo pkill server.py
sudo systemctl stop birdnet_recording.service
sudo rm -rf ${RECS_DIR}/$(date +%B-%Y/%d-%A)/*
services=(web_terminal.service
@@ -15,11 +17,13 @@ extraction.timer
extraction.service
chart_viewer.service
birdnet_recording.service
birdnet_log.service
birdnet_server.service
birdnet_analysis.service)
birdnet_log.service)
sudo pkill server.py
for i in "${services[@]}";do
sudo systemctl restart "${i}"
done
until grep 5050 <(netstat -tulpn 2>&1);do
sudo systemctl restart birdnet_server.service
sleep 30
done
sudo systemctl restart birdnet_analysis.service
+2 -3
View File
@@ -328,8 +328,7 @@ def handle_client(conn, addr):
# Write detections to Database
myReturn = ''
for i in detections:
print("\n", detections[i][0],"\n")
myReturn += str(detections[i][0]) + '||'
myReturn += str(i) + '-' + str(detections[i][0]) + '\n'
@@ -414,7 +413,7 @@ def handle_client(conn, addr):
print("Detection POST Response Status - ", response.status_code)
conn.send("Msg received".encode(FORMAT))
conn.send(myReturn.encode(FORMAT))
#time.sleep(3)