-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·38 lines (33 loc) · 888 Bytes
/
run.sh
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
#!/usr/bin/env bash
source env.sh
set -uo pipefail
exit_script() {
echo "exitting..."
trap - SIGINT SIGTERM # clear the trap
kill -- -$$ # Sends SIGTERM to child/sub processes
}
trap exit_script SIGINT SIGTERM
if [ $# -eq 0 ]; then
echo "specify input data!"
exit 1
fi
. ./venv/bin/activate
while true; do
(set -x; python3 processlist.py $@)
if [ $? != 0 ]; then
./textme.sh ERROR: processlist broken
fi
texted=0
while IFS='^' read -r age county zip num; do
T="$(date +%s)";
(set -x; python3 scraper.py "$age" "$county" "$zip" "$num")
if [ $? != 0 ] && [ $texted == 0 ]; then
./textme.sh ERROR: run broken for "$age" "$county" "$zip"
texted=1
fi
T="$(($(date +%s)-T))";
echo "Time in seconds: ${T}"
done < clean_list.csv
date
(set -x; sleep 600)
done