-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstop.sh
More file actions
executable file
·45 lines (45 loc) · 1.81 KB
/
stop.sh
File metadata and controls
executable file
·45 lines (45 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
SECONDS=0
# ---------------------------------------------------
YEAR=`date '+%Y'`
MONTH=`date '+%m'`
DAY=`date '+%d'`
HOUR=`date '+%H'`
# ---------------------------------------------------
# source the configuration file
# it must be edited and copied as ".BirdNET-BarChart" to you home directory
CONFIG_FILE=${HOME}/.BirdNET-BarChart
if [ -f "${CONFIG_FILE}" ]; then
source ${CONFIG_FILE}
else
echo " "
echo "${CONFIG_FILE} does not exist."
echo "Run the config.sh script to create."
echo " "
exit 1
fi
# ---------------------------------------------------
{
WORK_HOUR=${BARCHART_HOME}/work/${YEAR}/${MONTH}/${DAY}/${HOUR}
# ===================================================
# remove the crontab
export BARCHART_HOME && ${BARCHART_HOME}/util/crontabRemove.sh
# check if hourly has locked the process
SEMAPHORE="${BARCHART_HOME}/hourly.lock"
MESSAGE="Waiting for hourly completion."
WAITINTERVAL=5
export MESSAGE && export SEMAPHORE && export WAITINTERVAL && ${BARCHART_HOME}/util/blowBubbles.sh
# stop the last hourly script from sleeping
kill `ps h -eo pid,command | grep "sleep [0-9]*m" | grep -v "grep" | awk '{print $1}'`
echo " " > /dev/tty
# wait for the hourly script to finish
MESSAGE="Wait for the analysis to complete prior to completing. Usually less than 10 minutes."
export MESSAGE && export SEMAPHORE && export WAITINTERVAL && ${BARCHART_HOME}/util/blowBubbles.sh
echo " " > /dev/tty
echo "Stopped" > /dev/tty
# ===================================================
# how long did it take
DURATION=$SECONDS
echo "$(($DURATION / 60)) minutes and $(($DURATION % 60)) seconds elapsed."
echo "---------------------------------------------------------------------------------"
} >> ${BARCHART_HOME}/logs/${YEAR}-${MONTH}-${DAY}-${HOUR}-stop.out 2>> ${BARCHART_HOME}/logs/${YEAR}-${MONTH}-${DAY}-${HOUR}-stop.err