#!/bin/bash
date "+%Y-%m-%d %H:%M:%S"
prelogsize=
for((i=;i<=;i++));do
# 計算多個目錄大小
logsize=`du -sk /data1/kafka/datalog /data2/kafka/datalog /data3/kafka/datalog | awk -F '\t' '{logsize+=$1; if(NR==3)print logsize }'`
if [ $prelogsize -eq ] ;then
prelogsize=$logsize
else
# 計算表達式
newlogsize=`echo "$logsize - $prelogsize"|bc`
prelogsize=$logsize
fi
echo $newlogsize"KB/s"
#每隔1秒統計一次目錄大小
sleep
done;