Tweak to cope with different DB file names
[debian-cd-search.git] / watch_and_sync_db
1 #!/bin/sh
2
3 DBDIR="/srv/cdimage-search.debian.org/search-db"
4 LOCK=$DBDIR/lock
5
6 # Check to see if another sync is in progress
7 if lockfile -! -l 43200 -r 0 "$LOCK" >/dev/null 2>&1 ; then
8 #    echo `hostname` is unable to start CD sync, lock file exists
9     exit 1
10 fi
11 trap "rm -f $LOCK > /dev/null 2>&1" exit
12
13 cd $DBDIR
14
15 rsync cdimage.debian.org::cdimage/.search-db/trace trace.new
16 OLDTRACE=`cat trace`
17 NEWTRACE=`cat trace.new`
18 if [ "$OLDTRACE"x != "$NEWTRACE"x ] || [ "$1"x = "-f"x ] ; then
19     rsync -4rtl --delete cdimage.debian.org::cdimage/.search-db/ $DBDIR/
20 fi
21
22