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
|
#!/bin/bash
#
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# Initial setup for PPA cronscripts.
# DO NOT set LPCONFIG here, it should come from the crontab or the shell.
# Define common variables.
PPAROOT=/srv/launchpad.net/ppa-archive
P3AROOT=/srv/launchpad.net/private-ppa-archive
LOCKFILE=$PPAROOT/.lock
# Default lockfile options, retry once if it's locked.
if [ "$LOCKFILEOPTIONS" == "" ]; then
LOCKFILEOPTIONS="-r1"
fi
# Claim the lockfile.
if ! lockfile $LOCKFILEOPTIONS $LOCKFILE; then
echo "Could not claim lock file."
exit 1
fi
# Cleanup the lockfile on exit.
cleanup () {
echo "Cleaning up lockfile."
rm -f $LOCKFILE
}
trap cleanup EXIT
|