-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate_defaults
executable file
·30 lines (27 loc) · 1.02 KB
/
update_defaults
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
#!/bin/bash
die() {
echo "Error: $1" 1>&2
exit 1
}
cd $(dirname "$0") || die "Failed to change to script dir"
cp /var/lib/tiqit/data/tiqit.db data/tiqit.db
echo "Size of tiqit.db before: $(wc -c data/tiqit.db | cut -d' ' -f1) bytes"
echo "md5sum of tiqit.db before: $(md5sum data/tiqit.db | cut -d' ' -f1)"
LOGFILE="$(pwd)/updatedefaults_$(date --utc +%Y%m%d_%H%M%S).log"
echo "Logging to: $LOGFILE"
echo
cd scripts/ || die "Failed to change to scripts dir"
PYTHONPATH=. time util/updatedefaults.py &> "$LOGFILE"
echo "Return code: $?"
cd ..
echo "Log file is: $(wc -l "$LOGFILE" | cut -d' ' -f1) lines long"
echo "Size of tiqit.db after: $(wc -c data/tiqit.db | cut -d' ' -f1) bytes"
echo "md5sum of tiqit.db after: $(md5sum data/tiqit.db | cut -d' ' -f1)"
echo
echo "Review the log file and run:"
echo " cp $(pwd)/data/tiqit.db /var/lib/tiqit/data/tiqit.db"
echo "To update the live defaults DB."
echo
echo "Last 1000 lines of the log are below:"
echo
tail -1000 "$LOGFILE"