#!/bin/sh # Usage: get-workdir-space #Check number of arguments if [ $# -ne 1 ] then echo "Usage: get-workdir-space " echo "Examples: get-workdir-space all" echo " get-workdir-space BNL_ATLAS" exit 1 else poolHandle=$1 case ${poolHandle} in "all") POOLFILE=$GCE_LOCATION/gce-client/etc/pool.config.xml;; *) grep " /tmp/poolHandles.$$ if [ $? = 1 ] then cat /tmp/poolHandles.$$ echo "Error: pool handle of <${poolHandle}> not found" exit 1 else POOLFILE=/tmp/poolHandles.$$ fi;; esac fi if [ ! -s $POOLFILE ] then echo "file <${POOLFILE}> does not exist or has zero length" exit 1 fi #Get pool handles grep " /tmp/poolhandles.$$ for handle in `cat /tmp/poolhandles.$$` do if [ "${handle}" = "local" -o "${handle}" = "CERNLCG" ] then continue else grep -A 6 " /tmp/handledata.$$ #Get pool_url for gatekeeper pool_url=`grep "\"transfer\"" /tmp/handledata.$$ |cut -d '"' -f4` echo "${handle}:" echo " pool_url=${pool_url}" #Get the working directory workdir=`grep "" -f2 | cut -d"<" -f1`/capone echo " workdir=${workdir}" avail-space.sh $pool_url $workdir "working directory" fi done /bin/rm -f /tmp/poolhandles.$$ /tmp/handledata.$$ /tmp/poolHandles.$$