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
|