Skip to content

Commit 44da4d5

Browse files
committed
Tweaking the output of update-db to better see what's being done.
- Legacy-Id: 384
1 parent 90a414f commit 44da4d5

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

test/update-db

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ progdir=${0%/*}
1010

1111
cd $progdir/..
1212
build=$PWD
13+
state=/var/local/$program
1314

1415
function log() { logger -i -t $program -s "$*"; }
1516
function die() { log "$*; terminating."; echo "$program: Error: $*" 1>&2; exit 1; }
@@ -18,13 +19,18 @@ function die() { log "$*; terminating."; echo "$program: Error: $*" 1>&2; exit 1
1819
[ $DBDUMP ] || DBDUMP="$1"
1920
[ $DBDUMP ] || DBDUMP=/www/tools.ietf.org/events/raw/sqldump/sqldump.raw
2021
[ $DBFIX ] || DBFIX=$build/test/sql_fixup.sql
21-
[ $DBTIME ] || DBTIME=$build/update-db.time
22+
[ $DBTIME ] || DBTIME=$state/update-db.time
23+
[ $DBDONE ] || DBDONE=$state/update-db.done
2224

2325
LOCKDIR=/var/lock/ietfdb
2426
PIDFILE=$LOCKDIR/pid
2527

2628
while true; do
2729
if mkdir $LOCKDIR; then
30+
echo ""
31+
date +"Time: %Y-%m-%d %H:%M"
32+
log "Database dump file is from $(date -r $DBDUMP +'%Y-%m-%d %H:%M')."
33+
log "Last update done $(date -r $DBDONE +'%Y-%m-%d %H:%M')."
2834
if [ $DBDUMP -nt $DBTIME ]; then
2935
echo "$$" > $PIDFILE
3036
log "Updating local database from $DBDUMP ..."
@@ -34,9 +40,10 @@ while true; do
3440
log "Running Django syncdb ..."
3541
python ietf/manage.py syncdb
3642
touch -r $DBDUMP $DBTIME
43+
touch $DBDONE
3744
log "Done."
3845
else
39-
log "Database dump not newer than at previous update. Quitting."
46+
log "No new database dump available."
4047
fi
4148
rm -rf $LOCKDIR
4249
exit 0

0 commit comments

Comments
 (0)