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

# 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.7 LCGCP='lcg-cp'
11 paus 1.9 SRMCP='srmcp'
12 paus 1.6
13 paus 1.9 #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.9 #klist
20 paus 1.1
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 paus 1.9 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 paus 1.8
37 paus 1.6 #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 paus 1.1
45 paus 1.3 # make storage Urls for target and source
46 paus 1.1
47 paus 1.4 targetUrl="file:///$target"
48 paus 1.11 if [ "`echo $target | grep /mnt/hadoop/cms/store`" != "" ]
49 paus 1.6 then
50 paus 1.7 storageEle="se01.cmsaf.mit.edu"
51 paus 1.6 storagePath='/srm/v2/server?SFN='
52     targetUrl="srm://${storageEle}:8443${storagePath}$target"
53 paus 1.3 elif [ "`echo $target | grep /castor/cern.ch`" != "" ]
54 paus 1.1 then
55     storageEle='srm-cms.cern.ch'
56     storagePath='/srm/managerv2?SFN='
57 paus 1.3 targetUrl="srm://${storageEle}:8443${storagePath}$target"
58 paus 1.4 else
59 paus 1.9 targetUrl="file:///$target"
60     #targetUrl=""
61 paus 1.3 fi
62    
63 paus 1.4 sourceUrl="file:///$dataFile"
64 paus 1.11 if [ "`echo $dataFile | grep /mnt/hadoop/cms/store`" != "" ]
65 paus 1.6 then
66 paus 1.7 storageEle="se01.cmsaf.mit.edu"
67 paus 1.6 storagePath='/srm/v2/server?SFN='
68     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
69 paus 1.3 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 paus 1.1 fi
75    
76 paus 1.3 echo " "; echo "Starting download now"; echo " "
77 paus 1.11 echo "$LCGCP -D srmv2 -b $sourceUrl $targetUrl"
78     $LCGCP -D srmv2 -b $sourceUrl $targetUrl
79 paus 1.9
80 paus 1.11 #echo "$SRMCP -2 $sourceUrl $targetUrl"
81     #$SRMCP -2 $sourceUrl $targetUrl
82 paus 1.1
83     exit 0