ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/downloadFile.sh
Revision: 1.5
Committed: Thu Mar 31 08:37:21 2011 UTC (14 years, 1 month ago) by ceballos
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b
Changes since 1.4: +3 -4 lines
Log Message:
fix

File Contents

# Content
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 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 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 export VO_CMS_SW_DIR=/server/01a/mitdata/cmssoft
30 source $VO_CMS_SW_DIR/cmsset_default.sh
31 cd $HOME/cms/cmssw/019/CMSSW_3_9_7/src
32 eval `scram runtime -sh`
33 source $CMSSW_BASE/src/MitProd/Processing/bin/processing.sh
34 cd $pwd
35
36 # make storage Urls for target and source
37
38 targetUrl="file:///$target"
39 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 then
46 storageEle='srm-cms.cern.ch'
47 storagePath='/srm/managerv2?SFN='
48 targetUrl="srm://${storageEle}:8443${storagePath}$target"
49 else
50 targetUrl=""
51 fi
52
53 sourceUrl="file:///$dataFile"
54 if [ "`echo $dataFile | grep /pnfs/cmsaf.mit.edu`" != "" ]
55 then
56 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 fi
65
66 echo " "; echo "Starting download now"; echo " "
67 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
76 exit 0