forked from Cloud-PG/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmswn.sh
66 lines (56 loc) · 1.86 KB
/
cmswn.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# let's avoid black holes
if [ ! -f /cvmfs/cms.cern.ch/cmsset_default.sh ];then
echo "CVMFS Must run to allow job execution"
exit
fi
yum -y install ca-policy-egi-core
yum -y install ca-policy-lcg
/etc/init.d/fetch-crl-boot restart
cd /etc/yum.repos.d
wget https://ci.cloud.cnaf.infn.it/job/cnaf-mw-devel-jobs/job/ca_CMS-TTS-CA/job/master/lastSuccessfulBuild/artifact/ca_CMS-TTS-CA.repo
cd -
yum -y install ca_CMS-TTS-CA
resp=0
until [ $resp -eq 200 ]; do
resp=$(curl -s \
-w%{http_code} \
$PROXY_CACHE/cgi-bin/get_proxy -o /root/gwms_proxy)
done
echo $resp
#############
chmod 600 /root/gwms_proxy
export X509_USER_PROXY=/root/gwms_proxy
export X509_CERT_DIR=/etc/grid-security/certificates
grid-proxy-info
if [ $? -eq 0 ]; then
echo "proxy certificate is OK"
### Configure condor
str1=$(grep "GLIDEIN_Site =" /etc/condor/config.d/99_glidein)
sed -i -e "s/$str1/GLIDEIN_Site = \"$CMS_LOCAL_SITE\"/g" /etc/condor/config.d/99_glidein
str2=$(grep "GLIDEIN_CMSSite =" /etc/condor/config.d/99_glidein)
sed -i -e "s/$str2/GLIDEIN_CMSSite = \"$CMS_LOCAL_SITE\"/g" /etc/condor/config.d/99_glidein
export PATH=$PATH:/usr/libexec/condor
condor_master
export WN_TIMEOUT=60
COUNTER=0
###Check CVMFS status every 5s as it can create a black hole
###Check every 10 minutes if cmsRun executed at least once in the past hour.
while true; do
if [ ! -f /cvmfs/cms.cern.ch/cmsset_default.sh ];then
echo "CVMFS is down.. break docker execution"
break
fi
if [ "$COUNTER" == "120" ];then
COUNTER=0
cmd=$(find /var/log/condor -type f -name StartLog -mmin -$WN_TIMEOUT)
if [ -z $cmd ]; then
break
fi
fi
let COUNTER=COUNTER+1
sleep 5
done
else
echo "proxy certificate is Failure"
fi