forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
is-weekly-ib-available.sh
executable file
·29 lines (25 loc) · 1.04 KB
/
is-weekly-ib-available.sh
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
#!/bin/bash -ex
IB_WEEK_DIR="/cvmfs/cms-ib.cern.ch/week0 /cvmfs/cms-ib.cern.ch/week1 /cvmfs/cms.cern.ch"
RELEASE=$1
ARCH=$2
WAIT_STEP=$3
MAX_WAIT=$4
if [ "X$RELEASE" = "X" ] ; then echo "Error: Missing release name" ; echo "Usage: $0 RELEASE ARCH [WAIT_STEP: default 120s] [MAX_WAIT: default 7200s]"; exit 1; fi
if [ "X$ARCH" = "X" ] ; then echo "Error: Missing architecture name"; echo "Usage: $0 RELEASE ARCH [WAIT_STEP: default 120s] [MAX_WAIT: default 7200s]"; exit 1; fi
if [ "X$WAIT_STEP" = "X" ] ; then WAIT_STEP=120; fi
if [ "X$MAX_WAIT" = "X" ] ; then MAX_WAIT=7200; fi
TOTAL_WAIT=0
for dir in $IB_WEEK_DIR ; do
if [ ! -e ${dir} ] ; then echo "Error: No such directory: ${dir}"; exit 1; fi
done
while [ true ] ; do
for proj in cmssw cmssw-patch ; do
for dir in $IB_WEEK_DIR; do
if [ -d ${dir}/$ARCH/cms/$proj/$RELEASE ] ; then exit 0 ; fi
done
done
if [ $TOTAL_WAIT -gt $MAX_WAIT ] ; then exit 1; fi
echo "Waiting for IB since ${TOTAL_WAIT} secs"
sleep $WAIT_STEP
TOTAL_WAIT=$(expr $TOTAL_WAIT + $WAIT_STEP)
done