File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,22 +15,29 @@ function log() { logger -i -t $program -s "$*"; }
1515function die() { log " $* ; terminating." ; echo " $program : Error: $* " 1>&2 ; exit 1; }
1616
1717
18+ [ $DBDUMP ] || DBDUMP=" $1 "
1819[ $DBDUMP ] || DBDUMP=/www/tools.ietf.org/events/raw/sqldump/sqldump.raw
1920[ $DBFIX ] || DBFIX=$build /test/sql_fixup.sql
21+ [ $DBTIME ] || DBTIME=$build /update-db.time
2022
2123LOCKDIR=/var/lock/ietfdb
2224PIDFILE=$LOCKDIR /pid
2325
2426while true ; do
2527 if mkdir $LOCKDIR ; then
26- echo " $$ " > $PIDFILE
27- log " Updating local database from $DBDUMP ..."
28- python ietf/manage.py dbshell < $DBDUMP
29- log " Updating local database from $DBFIX ..."
30- python ietf/manage.py dbshell < $DBFIX
31- log " Running Django syncdb ..."
32- python ietf/manage.py syncdb
33- log " Done."
28+ if [ $DBDUMP -nt $DBTIME ]; then
29+ echo " $$ " > $PIDFILE
30+ log " Updating local database from $DBDUMP ..."
31+ python ietf/manage.py dbshell < $DBDUMP
32+ log " Updating local database from $DBFIX ..."
33+ python ietf/manage.py dbshell < $DBFIX
34+ log " Running Django syncdb ..."
35+ python ietf/manage.py syncdb
36+ touch -r $DBDUMP $DBTIME
37+ log " Done."
38+ else
39+ log " Database dump not newer than at previous update. Quitting."
40+ fi
3441 rm -rf $LOCKDIR
3542 exit 0
3643 else
You can’t perform that action at this time.
0 commit comments