| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | #******************************************************************************** |
|---|
| 11 | #*** Configuration *** |
|---|
| 12 | #******************************************************************************** |
|---|
| 13 | DCACHE_HOME="/opt/d-cache" |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | #******************************************************************************** |
|---|
| 19 | #*** Initialisations *** |
|---|
| 20 | #******************************************************************************** |
|---|
| 21 | pool_name="$1" |
|---|
| 22 | |
|---|
| 23 | #check whether the âpool_nameâ-parameter was set |
|---|
| 24 | if [ -z "${pool_name}" ]; then |
|---|
| 25 | printf "Please specify a pool name.\n" >&2 |
|---|
| 26 | exit 2 |
|---|
| 27 | fi |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | #******************************************************************************** |
|---|
| 33 | #*** Determine The Pool Directory *** |
|---|
| 34 | #******************************************************************************** |
|---|
| 35 | #get pool listing |
|---|
| 36 | pool_listing="$( "${DCACHE_HOME}"/bin/dcache pool ls | grep "${pool_name}" )" |
|---|
| 37 | |
|---|
| 38 | #check whether exactly one result was found |
|---|
| 39 | if [ "$( printf "%s\n" "${pool_listing}" | wc -l )" -ne 1 ]; then |
|---|
| 40 | printf "The pool with the name â${pool_name}â was not found or the listing could not be parsed.\n" >&2 |
|---|
| 41 | exit 1 |
|---|
| 42 | fi |
|---|
| 43 | |
|---|
| 44 | #parse the pool listing |
|---|
| 45 | pool_directory="$( printf "%s" "${pool_listing}" | sed 's/.* //' )" |
|---|
| 46 | #check whether the pool directory acutally exists |
|---|
| 47 | if [ ! -d "${pool_directory}" ]; then |
|---|
| 48 | printf "The determined pool directory â${pool_directory}â does not exist.\n" >&2 |
|---|
| 49 | exit 1 |
|---|
| 50 | fi |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | #******************************************************************************** |
|---|
| 56 | #*** List The Files In The Poolâs â/dataâ-Directory *** |
|---|
| 57 | #******************************************************************************** |
|---|
| 58 | ls -1 "${pool_directory}"/data |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | #Copyright © 2009, Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>. |
|---|
| 76 | #All rights reserved. |
|---|
| 77 | # |
|---|
| 78 | # |
|---|
| 79 | #This program is free software: you can redistribute it and/or modify |
|---|
| 80 | #it under the terms of the GNU General Public License as published by |
|---|
| 81 | #the Free Software Foundation, either version 3 of the License, or |
|---|
| 82 | #(at your option) any later version. |
|---|
| 83 | # |
|---|
| 84 | #This program is distributed in the hope that it will be useful, |
|---|
| 85 | #but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 86 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 87 | #GNU General Public License for more details. |
|---|
| 88 | # |
|---|
| 89 | #You should have received a copy of the GNU General Public License |
|---|
| 90 | #along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|