d_spc=`df -k | grep '/opt/ITM' |awk '{printf "%d", $4/1024}'`
a_num=`ls /opt/ITM/config/??.ini |wc -l`
if [ $(($a_num * 100)) -lt $((d_spc - 300 )) ]; then khd_maxsize=100; else khd_maxsize=20; fi
for i in `ls /opt/ITM/config/??.ini`; do
echo "Updating $i"
echo "# KHD - Limit ShortTermHistory files - 2015-01-09" >> $i
echo "KHD_TOTAL_HIST_MAXSIZE=$khd_maxsize" >> $i
echo "KHD_HISTSIZE_EVAL_INTERVAL=300" >> $i
done
#+ restart agent