ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/downloadFile.sh
Revision: 1.3
Committed: Thu Jan 6 22:30:07 2011 UTC (14 years, 4 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_020pre1, Mit_018
Changes since 1.2: +31 -31 lines
Log Message:
Adding more powerful copy.

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     klist
11 paus 1.3 id=`id -u`
12     cp ~/.krb5/x509up_u${id} /tmp/
13     cp ~/.krb5/ticket /tmp/krb5cc_${id}
14     ls -lhrt /tmp/krb5cc_${id}
15     export KRB5CCNAME=FILE:/tmp/krb5cc_${id}
16 paus 1.1 klist
17    
18     dataFile=$1
19     target=$2
20     procId=$$
21    
22     echo " DataFile: $dataFile to: $target"
23    
24     echo " "; echo "Initialize CMSSW"; echo " "
25     pwd
26     pwd=`pwd`
27    
28     export SCRAM_ARCH=slc5_ia32_gcc434
29 paus 1.3 export VO_CMS_SW_DIR=/osg/app/cmssoft/cms
30 paus 1.1 source $VO_CMS_SW_DIR/cmsset_default.sh
31 paus 1.3 cd $HOME/cms/cmssw/017/CMSSW_3_9_5_patch1/src
32 paus 1.1 eval `scram runtime -sh`
33     source $CMSSW_BASE/src/MitProd/Processing/bin/processing.sh
34     cd $pwd
35    
36 paus 1.3 # make storage Urls for target and source
37 paus 1.1
38 paus 1.3 targetUrl=$target
39     if [ "`echo $target | grep /pnfs/cmsaf.mit.edu`" != "" ]
40     then
41     storageEle="se01.cmsaf.mit.edu"
42     storagePath='/srm/managerv2?SFN='
43     targetUrl="srm://${storageEle}:8443${storagePath}$target"
44     elif [ "`echo $target | grep /castor/cern.ch`" != "" ]
45 paus 1.1 then
46     storageEle='srm-cms.cern.ch'
47     storagePath='/srm/managerv2?SFN='
48 paus 1.3 targetUrl="srm://${storageEle}:8443${storagePath}$target"
49     fi
50    
51     sourceUrl=$dataFile
52     if [ "`echo $dataFile | grep /pnfs/cmsaf.mit.edu`" != "" ]
53 paus 1.1 then
54 paus 1.3 storageEle="se01.cmsaf.mit.edu"
55     storagePath='/srm/managerv2?SFN='
56     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
57     elif [ "`echo $dataFile | grep /castor/cern.ch`" != "" ]
58     then
59     storageEle='srm-cms.cern.ch'
60     storagePath='/srm/managerv2?SFN='
61     sourceUrl="srm://${storageEle}:8443${storagePath}$dataFile"
62 paus 1.1 fi
63    
64 paus 1.3 echo " "; echo "Starting download now"; echo " "
65     echo "srm-copy $sourceUrl $targetUrl"
66     srm-copy $sourceUrl $targetUrl
67 paus 1.1
68     exit 0