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 |
|
|
export SCRAM_ARCH=slc5_ia32_gcc434
|
29 |
paus |
1.4 |
#export VO_CMS_SW_DIR=/osg/app/cmssoft/cms
|
30 |
|
|
export VO_CMS_SW_DIR=~cmsprod/cmssoft
|
31 |
paus |
1.1 |
source $VO_CMS_SW_DIR/cmsset_default.sh
|
32 |
paus |
1.3 |
cd $HOME/cms/cmssw/017/CMSSW_3_9_5_patch1/src
|
33 |
paus |
1.1 |
eval `scram runtime -sh`
|
34 |
|
|
source $CMSSW_BASE/src/MitProd/Processing/bin/processing.sh
|
35 |
|
|
cd $pwd
|
36 |
|
|
|
37 |
paus |
1.3 |
# make storage Urls for target and source
|
38 |
paus |
1.1 |
|
39 |
paus |
1.4 |
targetUrl="file:///$target"
|
40 |
paus |
1.3 |
if [ "`echo $target | grep /pnfs/cmsaf.mit.edu`" != "" ]
|
41 |
|
|
then
|
42 |
|
|
storageEle="se01.cmsaf.mit.edu"
|
43 |
|
|
storagePath='/srm/managerv2?SFN='
|
44 |
|
|
targetUrl="srm://${storageEle}:8443${storagePath}$target"
|
45 |
|
|
elif [ "`echo $target | grep /castor/cern.ch`" != "" ]
|
46 |
paus |
1.1 |
then
|
47 |
|
|
storageEle='srm-cms.cern.ch'
|
48 |
|
|
storagePath='/srm/managerv2?SFN='
|
49 |
paus |
1.3 |
targetUrl="srm://${storageEle}:8443${storagePath}$target"
|
50 |
paus |
1.4 |
else
|
51 |
|
|
targetUrl=""
|
52 |
paus |
1.3 |
fi
|
53 |
|
|
|
54 |
paus |
1.4 |
sourceUrl="file:///$dataFile"
|
55 |
paus |
1.3 |
if [ "`echo $dataFile | grep /pnfs/cmsaf.mit.edu`" != "" ]
|
56 |
paus |
1.1 |
then
|
57 |
paus |
1.3 |
storageEle="se01.cmsaf.mit.edu"
|
58 |
|
|
storagePath='/srm/managerv2?SFN='
|
59 |
|
|
sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
|
60 |
|
|
elif [ "`echo $dataFile | grep /castor/cern.ch`" != "" ]
|
61 |
|
|
then
|
62 |
|
|
storageEle='srm-cms.cern.ch'
|
63 |
|
|
storagePath='/srm/managerv2?SFN='
|
64 |
|
|
sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
|
65 |
paus |
1.1 |
fi
|
66 |
|
|
|
67 |
paus |
1.3 |
echo " "; echo "Starting download now"; echo " "
|
68 |
paus |
1.4 |
if [ "$targetUrl" != "" ]
|
69 |
|
|
then
|
70 |
|
|
echo "srmcp -srm_protocol_version=2 $sourceUrl $targetUrl"
|
71 |
|
|
srmcp -srm_protocol_version=2 $sourceUrl $targetUrl
|
72 |
|
|
else
|
73 |
|
|
echo "dccp dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target"
|
74 |
|
|
dccp dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target
|
75 |
|
|
fi
|
76 |
paus |
1.1 |
|
77 |
|
|
exit 0
|