ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/downloadFile.sh
Revision: 1.9
Committed: Tue Feb 28 11:54:35 2012 UTC (13 years, 2 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_028a, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d
Changes since 1.8: +15 -5 lines
Log Message:
Last updates.

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