generated from edgi-govdata-archiving/Template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_AllPrograms.sh
executable file
·39 lines (31 loc) · 1.23 KB
/
run_AllPrograms.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
#!/bin/bash
source ~/.profile
cd ${EEW_HOME}
CURRENTDATE=`date +"%Y-%m-%d"`
SAVENAME=region.db-${CURRENTDATE}
LOGNAME=AllPrograms.log-${CURRENTDATE}
ERRORNAME=AllPrograms.error-${CURRENTDATE}
mv AllPrograms.log ${LOGNAME}
mv AllPrograms.error ${ERRORNAME}
echo 'Saving the current region.db' > AllPrograms.log 2> AllPrograms.error
cp region.db ${SAVENAME}
date >> AllPrograms.log
echo 'Saving the log file from the last population of region.db' >> AllPrograms.log
echo 'Cleaning out the affected tables' >> AllPrograms.log
sqlite3 region.db < clean_regions.sql
echo 'Running the AllPrograms.py commands to populate region.db' >> AllPrograms.log
for file in `ls state_cd-*.csv`
do
date >> AllPrograms.log
python3 AllPrograms.py -d $file -f 2021 >> AllPrograms.log 2>> AllPrograms.error
if ! python3 check_AllPrograms.py -c $file; then
echo "Error on $file, retrying" >> AllPrograms.error;
date >> AllPrograms.log
python3 AllPrograms.py -d $file -f 2023 >> AllPrograms.log 2>> AllPrograms.error
if ! python3 check_AllPrograms.py -c $file; then
echo "Error on retrying $file, failure" >> AllPrograms.error;
fi
else
echo "$file found no errors" >> AllPrograms.log;
fi
done