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

# 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 DCCP='/afs/cern.ch/project/gd/LCG-share/3.1.44-0/d-cache/dcap/bin/dccp'
11 LCGCP='lcg-cp'
12 SRMCP='srmcp'
13
14 #klist
15 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 #klist
21
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 # legacy but works on 32 bit machines
33 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
38 #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
46 # make storage Urls for target and source
47
48 targetUrl="file:///$target"
49 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 elif [ "`echo $target | grep /mnt/hadoop/cms/store`" != "" ]
55 then
56 storageEle="se01.cmsaf.mit.edu"
57 storagePath='/srm/v2/server?SFN='
58 targetUrl="srm://${storageEle}:8443${storagePath}$target"
59 elif [ "`echo $target | grep /castor/cern.ch`" != "" ]
60 then
61 storageEle='srm-cms.cern.ch'
62 storagePath='/srm/managerv2?SFN='
63 targetUrl="srm://${storageEle}:8443${storagePath}$target"
64 else
65 targetUrl="file:///$target"
66 #targetUrl=""
67 fi
68
69 sourceUrl="file:///$dataFile"
70 if [ "`echo $dataFile | grep /pnfs/cmsaf.mit.edu`" != "" ]
71 then
72 storageEle="se01.cmsaf.mit.edu"
73 storagePath='/srm/managerv2?SFN='
74 sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
75 elif [ "`echo $dataFile | grep /mnt/hadoop/cms/store`" != "" ]
76 then
77 storageEle="se01.cmsaf.mit.edu"
78 storagePath='/srm/v2/server?SFN='
79 sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
80 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 fi
86
87 echo " "; echo "Starting download now"; echo " "
88 if [ "`echo $dataFile | grep /pnfs/cmsaf.mit.edu`" == "" ]
89 then
90
91 echo "$LCGCP -D srmv2 -b $sourceUrl $targetUrl"
92 $LCGCP -D srmv2 -b $sourceUrl $targetUrl
93
94 #echo "$SRMCP -2 $sourceUrl $targetUrl"
95 #$SRMCP -2 $sourceUrl $targetUrl
96
97 else
98 echo "$DCCP dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target"
99 $DCCP dcap://t2srv0005.cmsaf.mit.edu/$dataFile $target
100 fi
101
102 exit 0