~launchpad-pqm/launchpad/devel

4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
1
#!/bin/sh
8687.15.7 by Karl Fogel
Add the copyright header block to more files.
2
#
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
5
6
# This script runs the mirror prober scripts as the
4764 by Canonical.com Patch Queue Manager
[release-critical=kiko][!log] Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
7
# launchpad user every two hours. Typically the output
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
8
# will be sent to an email address for inspection.
9
7520.1.1 by Steve McInerney
Moving mirror-prober.sh script to run on loganberry
10
# Only run this script on loganberry
12326.1.1 by William Grant
Redirect mirror prober output to a log.
11
THISHOST=$(uname -n)
7520.1.1 by Steve McInerney
Moving mirror-prober.sh script to run on loganberry
12
if [ "loganberry" != "$THISHOST" ]
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
13
then
7520.1.1 by Steve McInerney
Moving mirror-prober.sh script to run on loganberry
14
        echo "This script must be run on loganberry."
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
15
        exit 1
16
fi
17
18
# Only run this as the launchpad user
12326.1.1 by William Grant
Redirect mirror prober output to a log.
19
USER=$(whoami)
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
20
if [ "launchpad" != "$USER" ]
21
then
22
        echo "Must be launchpad user to run this script."
23
        exit 1
24
fi
25
26
12330.1.1 by Diogo Matsubara
update mirror-prober wrapper script to use proper config file
27
export LPCONFIG=distromirror
4759.3.2 by Tom Haddon
Set http_proxy
28
export http_proxy=http://squid.internal:3128/
29
export ftp_proxy=http://squid.internal:3128/
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
30
12326.1.1 by William Grant
Redirect mirror prober output to a log.
31
LOGFILE=/srv/launchpad.net/production-logs/mirror-prober.log
32
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
33
LOCK=/var/lock/launchpad_mirror_prober.lock
34
lockfile -r0 -l 259200 $LOCK
35
if [ $? -ne 0 ]; then
12326.1.1 by William Grant
Redirect mirror prober output to a log.
36
    echo $(date): Unable to grab $LOCK lock - aborting | tee -a $LOGFILE
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
37
    ps fuxwww
38
    exit 1
39
fi
40
41
cd /srv/launchpad.net/production/launchpad/cronscripts
42
12326.1.1 by William Grant
Redirect mirror prober output to a log.
43
echo $(date): Grabbed lock >> $LOGFILE
44
45
echo $(date): Probing archive mirrors >> $LOGFILE
46
python -S distributionmirror-prober.py -q --content-type=archive --max-mirrors=20 --log-file=DEBUG:$LOGFILE
47
48
echo $(date): Probing cdimage mirrors >> $LOGFILE
49
python -S distributionmirror-prober.py -q --content-type=cdimage --max-mirrors=30 --log-file=DEBUG:$LOGFILE
50
51
echo $(date): Removing lock >> $LOGFILE
4759.3.1 by Tom Haddon
Mirror prober separated out from nightly.sh, some nightly.sh changes and rosetta config for forster
52
rm -f $LOCK
53