ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/removeSample.sh
Revision: 1.2
Committed: Sat Jun 29 03:05:18 2013 UTC (11 years, 10 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_032, Mit_031, HEAD
Changes since 1.1: +10 -1 lines
Log Message:
Improve lfn handling.

File Contents

# Content
1 #!/bin/bash
2 #---------------------------------------------------------------------------------------------------
3 # Remove an existing sample from disk and from catalog
4 #
5 #### CAREFUL WILL NOT WORK FOR CERN ####
6 #
7 #---------------------------------------------------------------------------------------------------
8 domain=`echo $HOSTNAME | cut -d'.' -f2-100`
9 CATALOG=~cmsprod/catalog
10
11 if [ "$domain" == "mit.edu" ]
12 then
13 # For MIT
14 SERVER="srm://se01.cmsaf.mit.edu:8443/srm/v2/server?SFN="
15 LOCATION="/mnt/hadoop/cms/store/user/paus"
16 LOCAL_LOCATION="/mnt/hadoop/cmsprod"
17 else
18 # For CERN
19 SERVER="srm://srm-cms.cern.ch:8443/srm/managerv2?SFN="
20 LOCATION="/castor/cern.ch/user/p/paus"
21 LOCAL_LOCATION="/data/hadoop/cmsprod"
22 fi
23
24 klist -s
25 if [ $? != 0 ]; then
26 kinit -f
27 fi
28
29 BOOK="$1"
30 SAMPLE="$2"
31 LOCATION="$3"
32
33 if [ "$BOOK" == "" ] || [ "$SAMPLE" == "" ]
34 then
35 echo " Sample and book have to be defined.... "
36 exit 0
37 else
38 echo " Removing sample: $SAMPLE from book: $BOOK"
39 fi
40
41 echo ""
42 echo "Trying to remove sample: $SAMPLE ($BOOK) from $LOCATION"
43
44 #### CAREFUL WILL NOT WORK FOR CERN ####
45
46 if [ "$LOCATION" == "" ] || [ "$LOCATION" == "T2MIT" ]
47 then
48 # remove the remote physical files
49 #glexec ./removeSample.sh ${BOOK} $SAMPLE exec
50 glexec hadoop dfs -rmr /cms/store/user/paus/${BOOK}/$SAMPLE
51 # remove remote catalogs
52 if [ -d $CATALOG/t2mit/$BOOK/$SAMPLE ]
53 then
54 rm -rf $CATALOG/t2mit/$BOOK/$SAMPLE
55 fi
56 fi
57
58 if [ "$LOCATION" == "" ] || [ "$LOCATION" == "LOCAL" ]
59 then
60 # remove the local files
61 if [ -d "${LOCAL_LOCATION}/${BOOK}/$SAMPLE" ]
62 then
63 rm -rf ${LOCAL_LOCATION}/${BOOK}/$SAMPLE
64 fi
65 # remove local catalogs
66 if [ -d $CATALOG/local/$BOOK/$SAMPLE ]
67 then
68 rm -rf $CATALOG/local/$BOOK/$SAMPLE
69 fi
70 fi
71
72 exit 0