2018-10-21 18:46:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-10-30 18:47:12 +00:00
|
|
|
oscs=( $( find /proc/fs/lustre/osc -mindepth 1 -maxdepth 1 -type d ) )
|
2018-11-14 11:27:24 +00:00
|
|
|
#echo $oscs
|
2018-10-30 18:47:12 +00:00
|
|
|
|
|
|
|
while [ ! 0 -eq ${#oscs[@]} ]; do
|
|
|
|
sync
|
2018-11-13 14:48:24 +00:00
|
|
|
echo 3 > /proc/sys/vm/drop_caches
|
2018-10-30 18:47:12 +00:00
|
|
|
|
|
|
|
for i in ${!oscs[@]}; do
|
2018-10-30 19:07:35 +00:00
|
|
|
used_mb=$( grep -h used_mb ${oscs[$i]}/osc_cached_mb | cut -d" " -f 2 )
|
|
|
|
if [ 0 == $used_mb ]; then
|
2018-11-14 11:27:24 +00:00
|
|
|
#echo "remove from list ${oscs[$i]}, because cache is $used_mb MB"
|
2018-10-30 18:47:12 +00:00
|
|
|
unset oscs[$i]
|
|
|
|
else
|
2018-11-13 14:48:24 +00:00
|
|
|
echo "skip ${oscs[$i]}, cache is still $used_mb MB"
|
2018-10-30 18:47:12 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|