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 |
|
|
. $HOME/.profile |
10 |
|
|
##echo $me running on `date` |
11 |
|
|
export PATH=$HOME/bin:$PATH |
12 |
|
|
me=`basename $0` |
13 |
|
|
LOG=$HOME/autobuild.log |
14 |
|
|
exec 2>&1 |
15 |
|
|
exec 1>$LOG |
16 |
|
|
|
17 |
|
|
LOCK=$HOME/autobuild.lck |
18 |
|
|
unlock () { |
19 |
|
|
rm -f $LOCK |
20 |
|
|
} |
21 |
|
|
count=0 |
22 |
|
|
maxcount=10 |
23 |
|
|
while [ -e $LOCK -a $count -lt $maxcount ] ; do |
24 |
|
|
count=$[count + 1] |
25 |
|
|
echo $me: $LOCK exists. Sleeping 300s [$count] |
26 |
|
|
sleep 300 |
27 |
|
|
done |
28 |
|
|
if [ $count -lt $maxcount ] ; then |
29 |
|
|
touch $LOCK |
30 |
|
|
trap unlock EXIT |
31 |
|
|
getdeliveries |
32 |
|
|
buildlatest && acceptbuild |
33 |
|
|
else |
34 |
|
|
echo $me: $LOCK exists, and slept enough. Giving up. |
35 |
|
|
exit 1 |
36 |
|
|
fi |
37 |
|
|
|
38 |
|
|
# send email instead of using the cron output, so that it is possible to |
39 |
|
|
# get a meaningful subject line. |
40 |
|
|
if [ -s $LOG ] ; then |
41 |
|
|
/usr/lib/sendmail -t <<EOF |
42 |
|
|
To: ccflib@astro.estec.esa.nl |
43 |
|
|
Subject: CCF build `date` |
44 |
|
|
|
45 |
|
|
`cat $LOG` |
46 |
|
|
|
47 |
|
|
EOF |
48 |
|
|
fi |