ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/downloadFile.sh
Revision: 1.11
Committed: Thu Aug 9 21:16:03 2012 UTC (12 years, 8 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, HEAD
Changes since 1.10: +6 -24 lines
Log Message:
For version 029.

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