Daemon services update
This commit is contained in:
parent
6b37e1cfc5
commit
2bedbac279
|
@ -28,9 +28,9 @@ mem() {
|
|||
string=$2
|
||||
substring=$1
|
||||
if [[ "$string" == *"$substring"* ]]; then
|
||||
true
|
||||
echo "true"
|
||||
else
|
||||
false
|
||||
echo "false"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -49,11 +49,11 @@ junk() {
|
|||
# Get all empty treatment directories
|
||||
junk="$junk $(find ${CHUNK_FOLDER}/out -type d -empty)"
|
||||
# Get all empty record directories
|
||||
treatement_folder=$(find "${CHUNK_FOLDER}/out/*" -type d ! -empty)
|
||||
treatement_folder=$(find -wholename "${CHUNK_FOLDER}/out/*" -type d ! -empty)
|
||||
if [[ ! -z ${treatement_folder} ]]; then
|
||||
for folder in $treatement_folder; do
|
||||
echo $folder
|
||||
if ! $(mem $folder $junk) && $(no_bird_in_model_output $folder); then
|
||||
if [[ ! $(mem $folder $junk) = "true" ]] && $(no_bird_in_model_output $folder); then
|
||||
junk="$junk $folder"
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
# Extract observations from a model output folder
|
||||
#
|
||||
|
||||
DEBUG=${DEBUG:-0}
|
||||
DEBUG=${DEBUG:-1}
|
||||
|
||||
set -e
|
||||
# set -x
|
||||
|
||||
debug() {
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
|
@ -40,7 +41,7 @@ if [[ -z ${LONGITUDE} ]]; then
|
|||
fi
|
||||
|
||||
model_outputs() {
|
||||
find -name "model.out.csv" -type f ! -empty
|
||||
ls ${CHUNK_FOLDER}/out/*/model.out.csv
|
||||
}
|
||||
|
||||
source_wav() {
|
||||
|
@ -59,10 +60,10 @@ record_datetime() {
|
|||
MM=$(echo $record_date | cut -c 5-6)
|
||||
DD=$(echo $record_date | cut -c 7-8)
|
||||
HH=$(echo $record_time | cut -c 1-2)
|
||||
MM=$(echo $record_time | cut -c 3-4)
|
||||
MI=$(echo $record_time | cut -c 3-4)
|
||||
SS=$(echo $record_time | cut -c 5-6)
|
||||
SSS="000"
|
||||
date="$YYYY-$MM-$DD $HH:$MM:$SS.$SSS"
|
||||
date="$YYYY-$MM-$DD $HH:$MI:$SS.$SSS"
|
||||
echo $date
|
||||
}
|
||||
|
||||
|
@ -102,15 +103,15 @@ save_observations() {
|
|||
debug "Observation already exists: $source_audio, $start, $end, $taxon_id, $location_id"
|
||||
exit 1
|
||||
else
|
||||
debug "Inserting observation: $source_audio, $start, $end, $taxon_id, $location_id"
|
||||
debug "Inserting observation: $source_audio, $start, $end, $taxon_id, $location_id, $datetime"
|
||||
insert_observation "$source_audio" "$start" "$end" "$taxon_id" "$location_id" "$confidence" "$datetime"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
# Remove all junk observations
|
||||
./daemon/birdnet_clean.sh
|
||||
# # Remove all junk observations
|
||||
# ./daemon/birdnet_clean.sh
|
||||
# Get model outputs
|
||||
for model_output in $(model_outputs); do
|
||||
save_observations $model_output
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
Description=BirdNET-stream Analyzis
|
||||
|
||||
[Service]
|
||||
User=$USER
|
||||
Group=$USER
|
||||
WorkingDirectory=$DIR
|
||||
User=<USER>
|
||||
Group=<USER>
|
||||
WorkingDirectory=<DIR>
|
||||
ExecStart=bash ./daemon/birdnet_analyzis.sh
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=BirdNET-stream miner service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=<USER>
|
||||
GROUP=<GROUP>
|
||||
WorkingDirectory=<DIR>
|
||||
ExecStart=bash ./daemon/birdnet_miner.sh
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=BirdNET-stream miner Timer
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* *:00
|
||||
Unit=birdnet_miner.service
|
||||
|
||||
[Install]
|
||||
WantedBy=basic.target
|
|
@ -4,10 +4,10 @@
|
|||
Description=BirdNET-stream recording
|
||||
|
||||
[Service]
|
||||
User=$USER
|
||||
Group=$DIR
|
||||
WorkingDirectory=$DIR
|
||||
ExecStart=bash ./daemon/birdnet_recording.sh"
|
||||
User=<USER>
|
||||
Group=<DIR>
|
||||
WorkingDirectory=<DIR>
|
||||
ExecStart=bash ./daemon/birdnet_recording.sh
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
Type=simple
|
||||
|
|
Loading…
Reference in New Issue