ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/renameSample.sh
(Generate patch)

Comparing UserCode/MitProd/Processing/bin/renameSample.sh (file contents):
Revision 1.2 by paus, Sun Dec 5 01:01:21 2010 UTC vs.
Revision 1.7 by paus, Wed Sep 28 21:02:50 2011 UTC

# Line 2 | Line 2
2   #---------------------------------------------------------------------------------------------------
3   # Rename an existing sample (so far all potentially exisiting catalog info will have to be redone)
4   #---------------------------------------------------------------------------------------------------
5 < SERVER="srm://se01.cmsaf.mit.edu:8443/srm/managerv2?SFN="
6 < LOCATION="/pnfs/cmsaf.mit.edu/t2bat/cms/store/user/paus"
7 < BOOK="filefi/016"
8 < LOCAL_LOCATION="/mnt/hadoop/cmsprod"
9 < CATALOG="/home/cmsprod/catalog"
10 < #SERVER="srm://srm-cms.cern.ch:8443/srm/managerv2?SFN="
11 < #LOCATION="/castor/cern.ch/user/p/paus/filefi/014"
5 > domain=`echo $HOSTNAME | cut -d'.' -f2-100`
6 > CATALOG="~cmsprod/catalog"
7 > BOOK="filefi/${MIT_VERS}"
8 > if [ "$domain" == "mit.edu" ]
9 > then
10 >  # For MIT
11 >  SERVER="srm://se01.cmsaf.mit.edu:8443/srm/managerv2?SFN="
12 >  LOCATION="/pnfs/cmsaf.mit.edu/t2bat/cms/store/user/paus"
13 >  LOCAL_LOCATION="/mnt/hadoop/cmsprod"
14 > else
15 >  # For CERN
16 >  SERVER="srm://srm-cms.cern.ch:8443/srm/managerv2?SFN="
17 >  LOCATION="/castor/cern.ch/user/p/paus"
18 >  LOCAL_LOCATION="/data/hadoop/cmsprod"
19 > fi
20 >
21 > klist -s
22 > if [ $? != 0 ]; then
23 >  kinit -f
24 > fi
25  
26   SOURCE="$1"
27   TARGET="$2"
28  
29 < sourceExists=`srmls ${SERVER}${LOCATION}/${BOOK} | grep $SOURCE`
29 > echo ""
30 > echo "Trying to rename sample: $SOURCE to $TARGET"
31 > echo "                     in: $SERVER/$LOCATION/$BOOK"
32 > echo ""
33 > echo ""
34 >
35 > sourceExists=`srmls -recursion_depth=0 ${SERVER}${LOCATION}/${BOOK}/$SOURCE 2> /dev/null`
36   echo " Existing - source: $sourceExists"
37 < targetExists=`srmls ${SERVER}${LOCATION}/${BOOK} | grep $TARGET`
37 > targetExists=`srmls -recursion_depth=0 ${SERVER}${LOCATION}/${BOOK}/$TARGET 2> /dev/null`
38   echo " Existing - target: $targetExists"
39  
40   # first the original files
41   if [ ".$sourceExists" != "." ] && [ ".$targetExists" == "." ]
42   then
43    move ${LOCATION}/${BOOK}/$SOURCE       ${LOCATION}/${BOOK}/$TARGET
44 +  ~paus/bin/repstr $SOURCE $TARGET       $MIT_RPOD_DIR/$BOOK/Productions.*
45   fi
46  
47   # now the local files

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines