ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/removeSample.sh
Revision: 1.1
Committed: Tue Feb 28 11:54:36 2012 UTC (13 years, 2 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d
Log Message:
Last updates.

File Contents

# User Rev Content
1 paus 1.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     echo ""
34     echo "Trying to remove sample: $SAMPLE ($BOOK) from $LOCATION"
35    
36     #### CAREFUL WILL NOT WORK FOR CERN ####
37    
38     if [ "$LOCATION" == "" ] || [ "$LOCATION" == "T2MIT" ]
39     then
40     # remove the remote physical files
41     glexec ./removeSample.sh ${BOOK} $SAMPLE exec
42     # remove remote catalogs
43     if [ -d $CATALOG/t2mit/$BOOK/$SAMPLE ]
44     then
45     rm -rf $CATALOG/t2mit/$BOOK/$SAMPLE
46     fi
47     fi
48    
49     if [ "$LOCATION" == "" ] || [ "$LOCATION" == "LOCAL" ]
50     then
51     # remove the local files
52     if [ -d "${LOCAL_LOCATION}/${BOOK}/$SAMPLE" ]
53     then
54     rm -rf ${LOCAL_LOCATION}/${BOOK}/$SAMPLE
55     fi
56     # remove local catalogs
57     if [ -d $CATALOG/local/$BOOK/$SAMPLE ]
58     then
59     rm -rf $CATALOG/local/$BOOK/$SAMPLE
60     fi
61     fi
62    
63     exit 0