File: jigdo-watcher

package info (click to toggle)
debian-cd 3.2.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,848 kB
  • sloc: sh: 6,129; perl: 4,129; makefile: 413
file content (55 lines) | stat: -rwxr-xr-x 1,481 bytes parent folder | download | duplicates (5)
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
47
48
49
50
51
52
53
54
55
#!/bin/bash

STATE=/home/stevem/watch-state

R_HOST=cd-builder.debian.net
R_LOC=testing/weekly-builds
R_WEBROOT=$R_LOC
R_RSYNCROOT=/srv/cdimage.debian.org/www/$R_LOC
R_USER=steve

CACHE_DIR=/srv/jigdo-snapshots
OUT_DIR=/srv/jigdo-area/testing
MIRROR=/srv/ftp/debian
SNAP_AREA=/srv/jigdo-area/snapshot
LOCK=$STATE/lock

# Check to see if another sync is in progress
if lockfile -! -l 43200 -r 0 "$LOCK" >/dev/null 2>&1 ; then
#    echo `hostname` is unable to start CD sync, lock file exists
    exit 1
fi
trap "rm -f $LOCK > /dev/null 2>&1" exit  

wget -q -O $STATE/cd.new http://$R_HOST/$R_WEBROOT/trace/bla.wolffelaar.nl
OLD=`cat $STATE/cd`
NEW=`cat $STATE/cd.new`
if [ "$OLD"x != "$NEW"x ] ; then
    echo "Old date $OLD, New $NEW"
    echo "Time to get new jigdos"
    mv -f $STATE/cd.new $STATE/cd

    rsync -rvtlz --delete \
	$R_USER@$R_HOST:$R_RSYNCROOT/ \
	$OUT_DIR/

    SNAP_DATE=`date +%Y%m%d`
    echo "And snapshot to $SNAP_DATE"

    mkdir -p $CACHE_DIR/$SNAP_DATE
    cd $OUT_DIR
    find . -name '*.jigdo' | xargs tar cf - | ( cd $CACHE_DIR/$SNAP_DATE && tar xf - )

    # Now generate a list of all the jigdo files that we should be
    # looking at
    find $CACHE_DIR -name '*.jigdo' > $CACHE_DIR/jigdo.list

    # And now update and check the snapshot from those jigdo files
    DATE=`date`
    echo "$DATE: Updating snapshot"

    ~/bin/mkjigsnap -m $MIRROR -d $SNAP_AREA/Debian -j $CACHE_DIR/jigdo.list -t ~/tmp

    DATE=`date`
    echo "  $DATE: done"
fi