forked from d101tm/tmstats
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdotraining101.sh
More file actions
executable file
·46 lines (34 loc) · 1.45 KB
/
dotraining101.sh
File metadata and controls
executable file
·46 lines (34 loc) · 1.45 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
46
#!/bin/bash
. setup.sh
cd "$workdir"
# rm latesttraining.html 2>/dev/null
echo "No updates to the training report were found." > trainingmessage.txt
../getfromdropbox.py --outfile latesttraining.html --namefile trainingfileinfo.txt --cfile ${cursordir}/trainingcursor.txt --ext htm html --dir Training || exit $?
echo $(date +"%B %e") | sed 's/ / /' > trainingreportdate.txt
../training.py latesttraining.html --bonus9a || exit $?
# If we're not on the real system, exit:
isreal || exit
export TARGET=$HOME/files/reports
if [ -d $TARGET ] ; then
for name in trainingreport*
do
isreal && cp $name $TARGET/${name/report/}
done
isreal && cp $(cat luckyfilename.txt) $TARGET/lucky7.html
isreal && cp $(cat luckyfilename.txt) $TARGET/
isreal && ../clearcache.py district-programs
# Now, create the message to the Program Quality Director
if [ -e trainingfileinfo.txt ] ; then
filets=" based on the data in $(cat trainingfileinfo.txt)"
else
filets=""
fi
filemsg="The training reports have been updated$filets"
cat > trainingmessage.txt << EOF
${filemsg}.
See http://files.d101tm.org/reports/training.html
There is an Excel version of the report at http://files.d101tm.org/reports/training.xlsx
The "Lucky 7" report is at http://files.d101tm.org/reports/lucky7.html (it's an HTML fragment)
EOF
isreal && ../sendmail.py --textfile trainingmessage.txt --to quality@d101tm.org --subject "$filemsg"
fi