1 |
paus |
1.1 |
#!/bin/bash
|
2 |
|
|
#---------------------------------------------------------------------------------------------------
|
3 |
|
|
# Download exactly one file, either interactively or submitting to condor batch system.
|
4 |
|
|
#
|
5 |
|
|
# Ch.Paus (Nov 18, 2010)
|
6 |
|
|
#---------------------------------------------------------------------------------------------------
|
7 |
|
|
echo " ";echo " ==== JOB ENVIRONMENT ==== ";echo " "; whoami;id;/bin/hostname;pwd
|
8 |
|
|
echo " ";echo " ==== START JOB WITH ARGUMENTS: $* ====";echo " "
|
9 |
|
|
|
10 |
|
|
klist
|
11 |
paus |
1.3 |
id=`id -u`
|
12 |
|
|
cp ~/.krb5/x509up_u${id} /tmp/
|
13 |
|
|
cp ~/.krb5/ticket /tmp/krb5cc_${id}
|
14 |
|
|
ls -lhrt /tmp/krb5cc_${id}
|
15 |
|
|
export KRB5CCNAME=FILE:/tmp/krb5cc_${id}
|
16 |
paus |
1.1 |
klist
|
17 |
|
|
|
18 |
|
|
dataFile=$1
|
19 |
|
|
target=$2
|
20 |
|
|
procId=$$
|
21 |
|
|
|
22 |
|
|
echo " DataFile: $dataFile to: $target"
|
23 |
|
|
|
24 |
|
|
echo " "; echo "Initialize CMSSW"; echo " "
|
25 |
|
|
pwd
|
26 |
|
|
pwd=`pwd`
|
27 |
|
|
|
28 |
ceballos |
1.5 |
export SCRAM_ARCH='slc5_ia32_gcc434'
|
29 |
|
|
export VO_CMS_SW_DIR=/server/01a/mitdata/cmssoft
|
30 |
paus |
1.1 |
source $VO_CMS_SW_DIR/cmsset_default.sh
|
31 |
ceballos |
1.5 |
cd $HOME/cms/cmssw/019/CMSSW_3_9_7/src
|
32 |
paus |
1.1 |
eval `scram runtime -sh`
|
33 |
|
|
source $CMSSW_BASE/src/MitProd/Processing/bin/processing.sh
|
34 |
|
|
cd $pwd
|
35 |
|
|
|
36 |
paus |
1.3 |
# make storage Urls for target and source
|
37 |
paus |
1.1 |
|
38 |
paus |
1.4 |
targetUrl="file:///$target"
|
39 |
paus |
1.3 |
if [ "`echo $target | grep /pnfs/cmsaf.mit.edu`" != "" ]
|
40 |
|
|
then
|
41 |
|
|
storageEle="se01.cmsaf.mit.edu"
|
42 |
|
|
storagePath='/srm/managerv2?SFN='
|
43 |
|
|
targetUrl="srm://${storageEle}:8443${storagePath}$target"
|
44 |
|
|
elif [ "`echo $target | grep /castor/cern.ch`" != "" ]
|
45 |
paus |
1.1 |
then
|
46 |
|
|
storageEle='srm-cms.cern.ch'
|
47 |
|
|
storagePath='/srm/managerv2?SFN='
|
48 |
paus |
1.3 |
targetUrl="srm://${storageEle}:8443${storagePath}$target"
|
49 |
paus |
1.4 |
else
|
50 |
|
|
targetUrl=""
|
51 |
paus |
1.3 |
fi
|
52 |
|
|
|
53 |
paus |
1.4 |
sourceUrl="file:///$dataFile"
|
54 |
paus |
1.3 |
if [ "`echo $dataFile | grep /pnfs/cmsaf.mit.edu`" != "" ]
|
55 |
paus |
1.1 |
then
|
56 |
paus |
1.3 |
storageEle="se01.cmsaf.mit.edu"
|
57 |
|
|
storagePath='/srm/managerv2?SFN='
|
58 |
|
|
sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
|
59 |
|
|
elif [ "`echo $dataFile | grep /castor/cern.ch`" != "" ]
|
60 |
|
|
then
|
61 |
|
|
storageEle='srm-cms.cern.ch'
|
62 |
|
|
storagePath='/srm/managerv2?SFN='
|
63 |
|
|
sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
|
64 |
paus |
1.1 |
fi
|
65 |
|
|
|
66 |
paus |
1.3 |
echo " "; echo "Starting download now"; echo " "
|
67 |
paus |
1.4 |
if [ "$targetUrl" != "" ]
|
68 |
|
|
then
|
69 |
|
|
echo "srmcp -srm_protocol_version=2 $sourceUrl $targetUrl"
|
70 |
|
|
srmcp -srm_protocol_version=2 $sourceUrl $targetUrl
|
71 |
|
|
else
|
72 |
|
|
echo "dccp dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target"
|
73 |
|
|
dccp dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target
|
74 |
|
|
fi
|
75 |
paus |
1.1 |
|
76 |
|
|
exit 0
|