ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/downloadFile.sh
Revision: 1.7
Committed: Wed Oct 19 10:43:11 2011 UTC (13 years, 6 months ago) by paus
Content type: application/x-sh
Branch: MAIN
Changes since 1.6: +5 -4 lines
Log Message:
Updates realted to hadoop move of Tier-2.

File Contents

# User Rev Content
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 paus 1.6 DCCP='/afs/cern.ch/project/gd/LCG-share/3.1.44-0/d-cache/dcap/bin/dccp'
11 paus 1.7 LCGCP='lcg-cp'
12 paus 1.6
13 paus 1.1 klist
14 paus 1.3 id=`id -u`
15     cp ~/.krb5/x509up_u${id} /tmp/
16     cp ~/.krb5/ticket /tmp/krb5cc_${id}
17     ls -lhrt /tmp/krb5cc_${id}
18     export KRB5CCNAME=FILE:/tmp/krb5cc_${id}
19 paus 1.1 klist
20    
21     dataFile=$1
22     target=$2
23     procId=$$
24    
25     echo " DataFile: $dataFile to: $target"
26    
27     echo " "; echo "Initialize CMSSW"; echo " "
28     pwd
29     pwd=`pwd`
30    
31 paus 1.6 #export SCRAM_ARCH='slc5_ia32_gcc434'
32     #export VO_CMS_SW_DIR=/server/01a/mitdata/cmssoft
33     #source $VO_CMS_SW_DIR/cmsset_default.sh
34     #cd $HOME/cms/cmssw/019/CMSSW_3_9_7/src
35     #eval `scram runtime -sh`
36     #source $CMSSW_BASE/src/MitProd/Processing/bin/processing.sh
37     #cd $pwd
38 paus 1.1
39 paus 1.3 # make storage Urls for target and source
40 paus 1.1
41 paus 1.4 targetUrl="file:///$target"
42 paus 1.3 if [ "`echo $target | grep /pnfs/cmsaf.mit.edu`" != "" ]
43     then
44     storageEle="se01.cmsaf.mit.edu"
45     storagePath='/srm/managerv2?SFN='
46     targetUrl="srm://${storageEle}:8443${storagePath}$target"
47 paus 1.6 elif [ "`echo $target | grep /mnt/hadoop/cms/store`" != "" ]
48     then
49 paus 1.7 storageEle="se01.cmsaf.mit.edu"
50 paus 1.6 storagePath='/srm/v2/server?SFN='
51     targetUrl="srm://${storageEle}:8443${storagePath}$target"
52 paus 1.3 elif [ "`echo $target | grep /castor/cern.ch`" != "" ]
53 paus 1.1 then
54     storageEle='srm-cms.cern.ch'
55     storagePath='/srm/managerv2?SFN='
56 paus 1.3 targetUrl="srm://${storageEle}:8443${storagePath}$target"
57 paus 1.4 else
58     targetUrl=""
59 paus 1.3 fi
60    
61 paus 1.4 sourceUrl="file:///$dataFile"
62 paus 1.3 if [ "`echo $dataFile | grep /pnfs/cmsaf.mit.edu`" != "" ]
63 paus 1.1 then
64 paus 1.3 storageEle="se01.cmsaf.mit.edu"
65     storagePath='/srm/managerv2?SFN='
66     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
67 paus 1.6 elif [ "`echo $dataFile | grep /mnt/hadoop/cms/store`" != "" ]
68     then
69 paus 1.7 storageEle="se01.cmsaf.mit.edu"
70 paus 1.6 storagePath='/srm/v2/server?SFN='
71     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
72 paus 1.3 elif [ "`echo $dataFile | grep /castor/cern.ch`" != "" ]
73     then
74     storageEle='srm-cms.cern.ch'
75     storagePath='/srm/managerv2?SFN='
76     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
77 paus 1.1 fi
78    
79 paus 1.3 echo " "; echo "Starting download now"; echo " "
80 paus 1.4 if [ "$targetUrl" != "" ]
81     then
82 paus 1.7 echo "$LCGCP -D srmv2 -b $sourceUrl $targetUrl"
83     $LCGCP -D srmv2 -b $sourceUrl $targetUrl
84 paus 1.4 else
85 paus 1.6 echo "$DCCP dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target"
86     $DCCP dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target
87 paus 1.4 fi
88 paus 1.1
89     exit 0