#!/bin/bash kind=$(mount | grep -i 'mdt') if [[ 'X' == "X${kind}" ]] then procFile='/proc/fs/lustre/ost/OSS/ost_io/req_history' else procFile='/proc/fs/lustre/mds/MDS/mdt/req_history' fi echo "using: ${procFile}" tmpDir='/tmp/io-use' char='1' ((delay = 1)) progress='.' if [[ "X" == "X$1" ]] then ((count = 10)) else count="$1" fi if [[ -d ${tmpDir} ]] then rm -rf ${tmpDir} fi mkdir ${tmpDir} cd ${tmpDir} # touch an empty file so that if no I/O is going on, we do not get a grep error touch dummy while ((0 < count)) do cat ${procFile} | grep -v Complete | awk -F':' '{print $3}' | sed 's/12345-//' | awk -F'@' '{print $1}' | while read num do name=$(grep ${num} /etc/hosts | head -1 | awk '{print $2}') if [[ 'X' == "X${name}" ]] then name="${num}" fi echo -n ${char} >> ${name} # echo -n ".$name." done ((count = count - 1)) echo -n ${progress} sleep ${delay} done echo " " grep -H ${char} * cd - >/dev/null rm -rf ${tmpDir}