1 |
ccflib |
1.1 |
#! /usr/local/bin/bash |
2 |
|
|
# |
3 |
|
|
# Giuseppe Vacanti, January 2000 |
4 |
|
|
# |
5 |
|
|
# + fetch new CCF deliveries |
6 |
|
|
# + build latest files |
7 |
|
|
# + move new files to CCF repository |
8 |
|
|
# |
9 |
ccflib |
1.3 |
# $Id$ |
10 |
|
|
# |
11 |
ccflib |
1.2 |
. $HOME/bin/ccflib.cfg |
12 |
ccflib |
1.1 |
##echo $me running on `date` |
13 |
|
|
export PATH=$HOME/bin:$PATH |
14 |
|
|
me=`basename $0` |
15 |
|
|
LOG=$HOME/autobuild.log |
16 |
|
|
exec 2>&1 |
17 |
|
|
exec 1>$LOG |
18 |
|
|
|
19 |
|
|
LOCK=$HOME/autobuild.lck |
20 |
|
|
unlock () { |
21 |
|
|
rm -f $LOCK |
22 |
|
|
} |
23 |
|
|
count=0 |
24 |
|
|
maxcount=10 |
25 |
|
|
while [ -e $LOCK -a $count -lt $maxcount ] ; do |
26 |
|
|
count=$[count + 1] |
27 |
|
|
echo $me: $LOCK exists. Sleeping 300s [$count] |
28 |
|
|
sleep 300 |
29 |
|
|
done |
30 |
|
|
if [ $count -lt $maxcount ] ; then |
31 |
|
|
touch $LOCK |
32 |
|
|
trap unlock EXIT |
33 |
|
|
getdeliveries |
34 |
|
|
buildlatest && acceptbuild |
35 |
|
|
else |
36 |
|
|
echo $me: $LOCK exists, and slept enough. Giving up. |
37 |
|
|
exit 1 |
38 |
|
|
fi |
39 |
|
|
|
40 |
|
|
# send email instead of using the cron output, so that it is possible to |
41 |
|
|
# get a meaningful subject line. |
42 |
|
|
if [ -s $LOG ] ; then |
43 |
|
|
/usr/lib/sendmail -t <<EOF |
44 |
ccflib |
1.2 |
To: ccflib@xmm.vilspa.esa.es |
45 |
ccflib |
1.1 |
Subject: CCF build `date` |
46 |
|
|
|
47 |
|
|
`cat $LOG` |
48 |
|
|
|
49 |
|
|
EOF |
50 |
|
|
fi |