echo"$filecount files in $hostcount nodes checked"
}
checkwce_main(){
checkwce_main(){
for host in$allnodes;do
if[-f$projdir/$host/full ];then
...
...
@@ -116,6 +116,45 @@ checkwce_main() {
done
}
cleanup_main(){
declare-if=0
savepwd=$(pwd)
sorton=".diff"
toclean=".tbdb .tmcc .full .diff"
echo"Must be root to run correctly"
for host in$allnodes;do
f=0
# for each node sort the ${sorton} directory by date
# save the two newest file and delete all the rest
# in ${sorton} ${toclean} directories
[[!-d$savepwd/$host/${sorton}]]&&continue
cd$savepwd/$host/${sorton}
sortedls=$(ls-t | paste-s-d\\\ -)
# pop the top 2 newest off
sortedls=${sortedls#*\ }
[[-z"$sortedls"]]&&continue
sortedls+=' '
[[-z"$sortedls"]]&&continue
sortedls=${sortedls#*\ }
[[-z"$sortedls"]]&&continue
sortedls+=' '
# print something
for i in$sortedls;do
((f++))
done
((f--))
echo"node:$host removing $f files from each ${toclean} directories"
# take the next file for timestamp
sortedls=${sortedls%%\ *}
[[-z"$sortedls"]]&&continue
dated=$savepwd/$host/${sorton}/${sortedls}
# using find delete older file
cd$savepwd/$host
find ${toclean}!-newer${dated}!-name${dated}-type f -execrm'{}'';'
done
}
# README
# to get HD info from serial number
# select b.node_id,b.bs_id,b.bsidx,a.attrvalue from blockstores as b,blockstore_attributes as a where b.bsidx=a.bsidx and b.role='element' and a.attrkey='serialnum' and a.attrvalue='$sn';