From 6860d197a39e2dfacd77e01ad2fc98c009bbddb7 Mon Sep 17 00:00:00 2001 From: Patrick McGuire Date: Mon, 29 Nov 2021 12:13:32 -0500 Subject: [PATCH] removed sudo from root script --- scripts/birdnet_analysis.sh | 68 +++++++++++++++++++++++++++++++------ scripts/install_services.sh | 2 +- scripts/update_services.sh | 2 +- 3 files changed, 60 insertions(+), 12 deletions(-) diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.sh index f7d6ff0..7d5d60b 100755 --- a/scripts/birdnet_analysis.sh +++ b/scripts/birdnet_analysis.sh @@ -91,18 +91,18 @@ run_analysis() { if [ "${RECORDING_LENGTH}" == "01:00" ];then until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "${RECORDING_LENGTH}" ];do sleep 1 - [ $a -ge 60 ] && sudo rm -f ${1}/${i} && break - a=$((a+1)) + [ $a -ge 60 ] && sudo rm -f ${1}/${i} && break + a=$((a+1)) done else until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "00:${RECORDING_LENGTH}" ];do sleep 1 - [ $a -ge ${RECORDING_LENGTH} ] && sudo rm -f ${1}/${i} && break - a=$((a+1)) + [ $a -ge ${RECORDING_LENGTH} ] && sudo rm -f ${1}/${i} && break + a=$((a+1)) done fi - if [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ];then + if [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ] && [ -z $STATION_NUMBER ];then echo "python3 analyze.py \ --i "${1}/${i}" \ --o "${1}/${i}.csv" \ @@ -119,9 +119,9 @@ run_analysis() { --lon "${LONGITUDE}" \ --week "${WEEK}" \ --overlap "${OVERLAP}" \ - --sensitivity "${SENSITIVITY}" \ + --sensitivity "${SENSITIVITY}" \ --min_conf "${CONFIDENCE}" - elif [ -f ${1}/${i} ] && [ -f ${CUSTOM_LIST} ];then + elif [ -f ${1}/${i} ] && [ -f ${CUSTOM_LIST} ] && [ -z $STATION_NUMBER ];then echo "python3 analyze.py \ --i "${1}/${i}" \ --o "${1}/${i}.csv" \ @@ -139,10 +139,58 @@ run_analysis() { --lon "${LONGITUDE}" \ --week "${WEEK}" \ --overlap "${OVERLAP}" \ - --sensitivity "${SENSITIVITY}" \ + --sensitivity "${SENSITIVITY}" \ --min_conf "${CONFIDENCE}" \ - --custom_list "${CUSTOM_LIST}" - fi + --custom_list "${CUSTOM_LIST}" + elif [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ] && [ ! -z $STATION_NUMBER ];then + echo "python3 analyze.py \ +--i "${1}/${i}" \ +--o "${1}/${i}.csv" \ +--lat "${LATITUDE}" \ +--lon "${LONGITUDE}" \ +--week "${WEEK}" \ +--overlap "${OVERLAP}" \ +--sensitivity "${SENSITIVITY}" \ +--min_conf "${CONFIDENCE}" \ +--s "${STATION_NUMBER}"\ +--meta_data "${STATION_NAME}"" + "${VENV}"/bin/python analyze.py \ + --i "${1}/${i}" \ + --o "${1}/${i}.csv" \ + --lat "${LATITUDE}" \ + --lon "${LONGITUDE}" \ + --week "${WEEK}" \ + --overlap "${OVERLAP}" \ + --sensitivity "${SENSITIVITY}" \ + --min_conf "${CONFIDENCE}" \ + --s "${STATION_NUMBER}"\ + --meta_data "${STATION_NAME}" + elif [ -f ${1}/${i} ] && [ -f ${CUSTOM_LIST} ] && [ ! -z $STATION_NUMBER ];then + echo "python3 analyze.py \ +--i "${1}/${i}" \ +--o "${1}/${i}.csv" \ +--lat "${LATITUDE}" \ +--lon "${LONGITUDE}" \ +--week "${WEEK}" \ +--overlap "${OVERLAP}" \ +--sensitivity "${SENSITIVITY}" \ +--min_conf "${CONFIDENCE}" \ +--custom_list "${CUSTOM_LIST}"\ +--s "${STATION_NUMBER}"\ +--meta_data "${STATION_NAME}"" + "${VENV}"/bin/python analyze.py \ + --i "${1}/${i}" \ + --o "${1}/${i}.csv" \ + --lat "${LATITUDE}" \ + --lon "${LONGITUDE}" \ + --week "${WEEK}" \ + --overlap "${OVERLAP}" \ + --sensitivity "${SENSITIVITY}" \ + --min_conf "${CONFIDENCE}" \ + --custom_list "${CUSTOM_LIST}"\ + --s "${STATION_NUMBER}"\ + --meta_data "${STATION_NAME}" + fi done } diff --git a/scripts/install_services.sh b/scripts/install_services.sh index 161e430..738a4d6 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -317,7 +317,7 @@ ExecStart=/usr/local/bin/daily_plot.py [Install] WantedBy=multi-user.target EOF - sudo systemctl enable chart_viewer.service + systemctl enable chart_viewer.service } install_gotty_logs() { diff --git a/scripts/update_services.sh b/scripts/update_services.sh index af149ed..9cd974c 100755 --- a/scripts/update_services.sh +++ b/scripts/update_services.sh @@ -315,7 +315,7 @@ ExecStart=/usr/local/bin/daily_plot.py [Install] WantedBy=multi-user.target EOF - sudo systemctl enable chart_viewer.service + systemctl enable chart_viewer.service } install_gotty_logs() {