ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/downloadFile.sh
Revision: 1.8
Committed: Thu Oct 20 23:07:28 2011 UTC (13 years, 6 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_025c_branch1, Mit_025c_branch0, Mit_025c, Mit_025b, Mit_025a
Branch point for: Mit_025c_branch
Changes since 1.7: +3 -0 lines
Log Message:
Update to include hadoop properly.

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.8 # legacy but works on 32 bit machines
32     source /afs/cern.ch/cms/LCG/LCG-2/UI/cms_ui_env_3_1.sh
33    
34 paus 1.6 #export SCRAM_ARCH='slc5_ia32_gcc434'
35     #export VO_CMS_SW_DIR=/server/01a/mitdata/cmssoft
36     #source $VO_CMS_SW_DIR/cmsset_default.sh
37     #cd $HOME/cms/cmssw/019/CMSSW_3_9_7/src
38     #eval `scram runtime -sh`
39     #source $CMSSW_BASE/src/MitProd/Processing/bin/processing.sh
40     #cd $pwd
41 paus 1.1
42 paus 1.3 # make storage Urls for target and source
43 paus 1.1
44 paus 1.4 targetUrl="file:///$target"
45 paus 1.3 if [ "`echo $target | grep /pnfs/cmsaf.mit.edu`" != "" ]
46     then
47     storageEle="se01.cmsaf.mit.edu"
48     storagePath='/srm/managerv2?SFN='
49     targetUrl="srm://${storageEle}:8443${storagePath}$target"
50 paus 1.6 elif [ "`echo $target | grep /mnt/hadoop/cms/store`" != "" ]
51     then
52 paus 1.7 storageEle="se01.cmsaf.mit.edu"
53 paus 1.6 storagePath='/srm/v2/server?SFN='
54     targetUrl="srm://${storageEle}:8443${storagePath}$target"
55 paus 1.3 elif [ "`echo $target | grep /castor/cern.ch`" != "" ]
56 paus 1.1 then
57     storageEle='srm-cms.cern.ch'
58     storagePath='/srm/managerv2?SFN='
59 paus 1.3 targetUrl="srm://${storageEle}:8443${storagePath}$target"
60 paus 1.4 else
61     targetUrl=""
62 paus 1.3 fi
63    
64 paus 1.4 sourceUrl="file:///$dataFile"
65 paus 1.3 if [ "`echo $dataFile | grep /pnfs/cmsaf.mit.edu`" != "" ]
66 paus 1.1 then
67 paus 1.3 storageEle="se01.cmsaf.mit.edu"
68     storagePath='/srm/managerv2?SFN='
69     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
70 paus 1.6 elif [ "`echo $dataFile | grep /mnt/hadoop/cms/store`" != "" ]
71     then
72 paus 1.7 storageEle="se01.cmsaf.mit.edu"
73 paus 1.6 storagePath='/srm/v2/server?SFN='
74     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
75 paus 1.3 elif [ "`echo $dataFile | grep /castor/cern.ch`" != "" ]
76     then
77     storageEle='srm-cms.cern.ch'
78     storagePath='/srm/managerv2?SFN='
79     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
80 paus 1.1 fi
81    
82 paus 1.3 echo " "; echo "Starting download now"; echo " "
83 paus 1.4 if [ "$targetUrl" != "" ]
84     then
85 paus 1.7 echo "$LCGCP -D srmv2 -b $sourceUrl $targetUrl"
86     $LCGCP -D srmv2 -b $sourceUrl $targetUrl
87 paus 1.4 else
88 paus 1.6 echo "$DCCP dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target"
89     $DCCP dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target
90 paus 1.4 fi
91 paus 1.1
92     exit 0