~launchpad-pqm/launchpad/devel

4355.1.1 by Tom Haddon
Supermirror Rewritemap cronscript needs to be in RF - calls a script from outside because it needs the rsync password and we do not want to expose that in plain text
1
#!/bin/sh
2
3
RSYNC_FILE=/srv/launchpad.net/etc/supermirror_rewritemap.conf
4355.1.4 by Tom Haddon
Hard coding the python version and hopefully making the comment about config file import a little clearer
4
PYTHON_VERSION=2.4
4355.1.5 by Tom Haddon
Using full path for python executable
5
PYTHON=/usr/bin/python${PYTHON_VERSION}
4355.1.1 by Tom Haddon
Supermirror Rewritemap cronscript needs to be in RF - calls a script from outside because it needs the rsync password and we do not want to expose that in plain text
6
7
if [ -f "$RSYNC_FILE" ]
8
then
4355.1.4 by Tom Haddon
Hard coding the python version and hopefully making the comment about config file import a little clearer
9
    # Because we don't want to put the rsync password in a revision controlled
10
    # file, we store it in a configuration file.  By sourcing the configuration
11
    # file here, this makes it available for use by this script.
4355.1.1 by Tom Haddon
Supermirror Rewritemap cronscript needs to be in RF - calls a script from outside because it needs the rsync password and we do not want to expose that in plain text
12
    . $RSYNC_FILE
13
else
14
    echo `date` "Supermirror config file not found, exiting"
15
    exit 1
16
fi
17
4355.1.3 by Tom Haddon
Added comment per suggestion from Brad about overwriting LPCONFIG variable
18
# We want to override any value that's been set so that
19
# when this script is run it always uses LPCONFIG=lpnet1
4355.1.2 by Tom Haddon
Use $MAP variable for readability and include comment explaining what we are importing
20
export LPCONFIG=lpnet1
21
4355.1.1 by Tom Haddon
Supermirror Rewritemap cronscript needs to be in RF - calls a script from outside because it needs the rsync password and we do not want to expose that in plain text
22
cd  /srv/launchpad.net/production/launchpad/cronscripts
23
24
LOCK=/var/lock/smrewrite.lock
4777.3.1 by Tom Haddon
Moving the rewrite map out of /tmp
25
MAP=/srv/launchpad.net/var/new-sm-map
4355.1.1 by Tom Haddon
Supermirror Rewritemap cronscript needs to be in RF - calls a script from outside because it needs the rsync password and we do not want to expose that in plain text
26
27
lockfile -l 600 ${LOCK}
28
4355.1.4 by Tom Haddon
Hard coding the python version and hopefully making the comment about config file import a little clearer
29
$PYTHON supermirror_rewritemap.py -q ${MAP} && rsync ${MAP} \
4355.1.1 by Tom Haddon
Supermirror Rewritemap cronscript needs to be in RF - calls a script from outside because it needs the rsync password and we do not want to expose that in plain text
30
        launchpad@bazaar.launchpad.net::config/launchpad-lookup.txt
31
32
rm -f ${LOCK}