#!/bin/bash # ---------------------------------------------------------------------- # File: eos-fst-clean # Author: Andreas-Joachim Peters - CERN # ---------------------------------------------------------------------- # ************************************************************************ # * EOS - the CERN Disk Storage System * # * Copyright (C) 2011 CERN/Switzerland * # * * # * This program is free software: you can redistribute it and/or modify * # * it under the terms of the GNU General Public License as published by * # * the Free Software Foundation, either version 3 of the License, or * # * (at your option) any later version. * # * * # * This program is distributed in the hope that it will be useful, * # * but WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * # * GNU General Public License for more details. * # * * # * You should have received a copy of the GNU General Public License * # * along with this program. If not, see .* # ************************************************************************ runtest="yes"; if [ "x$1" = "x--do-cleanup" ]; then runtest="no"; fi echo "# [ to execute the cleaning of the FST give '--do-cleanup' as option ] ..."; for name in `cat /var/eos/md/so.fst.dump | grep "key=path" | awk '{print $2}' | sed s/value://`; do nfiles=`find $name -type f | wc -l`; ndirs=`find $name -type d | wc -l`; echo "# (test=$runtest) FST Disk under path=$name nfiles=$nfiles ndirs=$ndirs"; done; ECHO="echo" if [ "$runtest" = "no" ]; then ECHO="" fi echo "# Cleaning FST disk ..." for name in `cat /var/eos/md/so.fst.dump | grep "key=path" | awk '{print $2}' | sed s/value://`; do $ECHO rm -rf /$name 2> /dev/null done echo "# Cleaning /var/eos ..." for name in auth config html md report stage ; do $ECHO rm -rf /var/eos/$name 2> /dev/null done echo "# Removing /etc/xrd.cf.fst ..." $ECHO rm -rf /etc/xrd.cf.fst 2> /dev/null echo "# Removing /etc/sysconfig/eos ..." $ECHO rm -rf /etc/sysconfig/eos 2> /dev/null echo "# Removing /var/log/eos/fst ..." $ECHO rm -rf /var/log/eos/fst 2> /dev/null echo "# Removing /var/spool/eos/fst ..." $ECHO rm -rf /var/spool/eos/fst 2> /dev/null