ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/downloadFile.sh
Revision: 1.6
Committed: Mon Sep 19 21:45:40 2011 UTC (13 years, 7 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_025, Mit_025pre2
Changes since 1.5: +21 -9 lines
Log Message:
Reinstate the bin and python areas.

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