~launchpad-pqm/launchpad/devel

8520.3.1 by Celso Providelo
Splitting PPA cron jobs.
1
#!/bin/bash
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).
8520.3.1 by Celso Providelo
Splitting PPA cron jobs.
5
6
# Initial setup for PPA cronscripts.
7
11049.1.1 by Julian Edwards
Don't set LPCONFIG in scripts
8
# DO NOT set LPCONFIG here, it should come from the crontab or the shell.
9
# Define common variables.
8520.3.1 by Celso Providelo
Splitting PPA cron jobs.
10
PPAROOT=/srv/launchpad.net/ppa-archive
11
P3AROOT=/srv/launchpad.net/private-ppa-archive
12
LOCKFILE=$PPAROOT/.lock
13
# Default lockfile options, retry once if it's locked.
14
if [ "$LOCKFILEOPTIONS" == "" ]; then
15
   LOCKFILEOPTIONS="-r1"
16
fi
17
18
# Claim the lockfile.
19
if ! lockfile $LOCKFILEOPTIONS $LOCKFILE; then
20
  echo "Could not claim lock file."
21
  exit 1
22
fi
23
24
# Cleanup the lockfile on exit.
25
cleanup () {
26
  echo "Cleaning up lockfile."
27
  rm -f $LOCKFILE
28
}
29
30
trap cleanup EXIT