-
Notifications
You must be signed in to change notification settings - Fork 6
/
cms-opendata-2011.context
109 lines (98 loc) · 4.15 KB
/
cms-opendata-2011.context
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh.before
parents=$(pid=$$; while [ $pid -ne 1 ]; do pid=$(ps -o ppid= -p $pid); cat /proc/$(echo $pid)/cmdline; done)
if ! echo $parents | grep -q amiconfig; then
echo "Skipping startup script, which should only run under amiconfig daemon"
exit 0
fi
# Set CVMFS cache size to 20G
echo "CVMFS_QUOTA_LIMIT=20000 # 20G cache" > /etc/cvmfs/default.local
echo "export CMS_LOCAL_SITE=/etc/cms/SITECONF/T2_UK_London_IC" > /etc/cvmfs/config.d/cms.cern.ch.local
echo "export SCRAM_ARCH=slc6_amd64_gcc472" > /etc/profile.d/cms.sh
echo "source /cvmfs/cms.cern.ch/cmsset_default.sh" >> /etc/profile.d/cms.sh
echo 'PS1="[Outer Shell \W] "' >> /etc/profile.d/cms.sh
chmod 0755 /etc/profile.d/cms.sh
cat << EOFOUTER > /usr/bin/cms-shell
#!/bin/sh
TMPRC=\$(mktemp)
cat > \$TMPRC << EOF
PS1='\[\e]2;CMS Shell\a\]\[\e[1;32m\]CMS Shell >\[\e[m\]\[\e[0;32m\] '
EOF
echo 'HISTFILE=~/.cms_history' >> \$TMPRC
echo '. /cvmfs/cms.cern.ch/cmsset_default.sh' >> \$TMPRC
cvmfs_config probe
echo "Starting up CMS shell..."
TZ_SRC=\$(readlink /etc/localtime)
TZ_DST=\$(readlink /cvmfs/cernvm-prod.cern.ch/cvm3/etc/localtime)
singularity exec \
-B \$TZ_SRC:\$TZ_DST \
-B /usr/share/X11/xkb/rules \
-B /etc/mtab \
-B /etc/cvmfs \
-B /etc/cms \
-B /cvmfs \
-B /eos \
/cvmfs/cernvm-prod.cern.ch/cvm3 /bin/bash --noprofile --rcfile \$TMPRC
rm -f \$TMPRC
EOFOUTER
chmod 0755 /usr/bin/cms-shell
# Hack for CMSSW bug (?)
ln -s /cvmfs/cms.cern.ch/SITECONF /etc/cvmfs/SITECONF
# Avoid xroot client warnings
touch /etc/profile.d/xrootd-protocol.sh
echo '
export XrdSecPROTOCOL=unix
' > /etc/profile.d/xrootd-protocol.sh
# Manual SITECONF, ideally at some point part of /cvmfs/cms.cern.ch
mkdir -p /etc/cms/SITECONF/T2_UK_London_IC/{JobConfig,PhEDEx}
ln -s T2_UK_London_IC /etc/cms/SITECONF/local
echo '
<storage-mapping>
<lfn-to-pfn protocol="root" destination-match=".*"
path-match="(.*)" result="root://eospublic.cern.ch/$1"/>
<lfn-to-pfn protocol="xrootd" destination-match=".*" chain="root"
path-match="(.*)" result="$1"/>
<!-- fallback xrootd rules -->
<lfn-to-pfn protocol="xrootd-uk2" destination-match=".*"
path-match="(.*)" result="root://xrootd-uk-cms.gridpp.rl.ac.uk/$1"/>
<lfn-to-pfn protocol="xrootd-eu" destination-match=".*"
path-match="(.*)" result="root://xrootd.ba.infn.it/$1"/>
<!-- combine all fallbacks into 1 rule, cmssw can only have 1 fallback -->
<!-- server chain stops when one server responds - even if it does not have
the file -->
<lfn-to-pfn protocol="fallbacks" destination-match=".*"
path-match="(.*)"
result="root://cms-xrd-global.cern.ch,xrootd.ba.infn.it,xrootd.unl.edu/$1?tried=gfe02.grid.hep.ph.ic.ac.uk"/>
<pfn-to-lfn protocol="direct" destination-match=".*"
path-match=".*(/store/.*)" result="$1"/>
<pfn-to-lfn protocol="root" destination-match=".*" chain="direct"
path-match="(.*)" result="$1"/>
<pfn-to-lfn protocol="xrootd" destination-match=".*" chain="root"
path-match="(.*)" result="$1"/>
</storage-mapping>
' > /etc/cms/SITECONF/T2_UK_London_IC/PhEDEx/storage.xml
echo '
<site-local-config>
<site name="T2_UK_London_IC">
<event-data>
<catalog
url="trivialcatalog_file:/etc/cvmfs/SITECONF/local/PhEDEx/storage.xml?protocol=root"/>
<catalog
url="trivialcatalog_file:/etc/cvmfs/SITECONF/local/PhEDEx/storage.xml?protocol=fallbacks"/>
</event-data>
<calib-data>
</calib-data>
</site>
</site-local-config>
' > /etc/cms/SITECONF/T2_UK_London_IC/JobConfig/site-local-config.xml
exit 0
[cernvm]
repositories=cms.cern.ch,cms-opendata-conddb.cern.ch
shell=/bin/bash
config_url=http://cernvm.cern.ch/config
users=cms-opendata:cms-opendata:password
edition=Desktop
screenRes=1280x700
keyboard=us
startXDM=on
auto_login=on
desktop_icons=CMS~OpenData,W0Rlc2t0b3AgRW50cnldClZlcnNpb249MS4wCkVuY29kaW5nPVVURi04ClR5cGU9TGluawpOYW1lPVJlYWQgTWUKQ29tbWVudD0KSWNvbj0vdXNyL3NoYXJlL2ljb25zL2Ntcy5qcGcKVVJMPWh0dHA6Ly9vcGVuZGF0YS5jZXJuLmNoL1ZNL0NNUwpHZW5lcmljTmFtZT0K%CMS~Shell,W0Rlc2t0b3AgRW50cnldClZlcnNpb249MS4wClR5cGU9QXBwbGljYXRpb24KTmFtZT1DTVMgU2hlbGwKQ29tbWVudD0KRXhlYz0vdXNyL2Jpbi9jbXMtc2hlbGwKSWNvbj11dGlsaXRpZXMtdGVybWluYWwKUGF0aD0KVGVybWluYWw9dHJ1ZQpTdGFydHVwTm90aWZ5PWZhbHNlCg==