Commit 318c2fa4 authored by Dan Reading's avatar Dan Reading
Browse files

in cleanup_main cd to the inventory directory for check for //

parent 18adae3a
...@@ -121,14 +121,15 @@ cleanup_main() { ...@@ -121,14 +121,15 @@ cleanup_main() {
savepwd=$(pwd) savepwd=$(pwd)
sorton=".diff" sorton=".diff"
toclean=".tbdb .tmcc .full .diff" toclean=".tbdb .tmcc .full .diff"
echo "Must be root to run correctly" cd $projdir
# echo "Must be root to run correctly"
for host in $allnodes ; do for host in $allnodes ; do
f=0 f=0
# for each node sort the ${sorton} directory by date # for each node sort the ${sorton} directory by date
# save the two newest file and delete all the rest # save the two newest file and delete all the rest
# in ${sorton} ${toclean} directories # in ${sorton} ${toclean} directories
[[ ! -d $savepwd/$host/${sorton} ]] && continue [[ ! -d $projdir/$host/${sorton} ]] && continue
cd $savepwd/$host/${sorton} cd $projdir/$host/${sorton}
sortedls=$(ls -t | paste -s -d \\\ -) sortedls=$(ls -t | paste -s -d \\\ -)
# pop the top 2 newest off # pop the top 2 newest off
sortedls=${sortedls#*\ } sortedls=${sortedls#*\ }
...@@ -148,11 +149,12 @@ cleanup_main() { ...@@ -148,11 +149,12 @@ cleanup_main() {
# take the next file for timestamp # take the next file for timestamp
sortedls=${sortedls%%\ *} sortedls=${sortedls%%\ *}
[[ -z "$sortedls" ]] && continue [[ -z "$sortedls" ]] && continue
dated=$savepwd/$host/${sorton}/${sortedls} dated=$projdir/$host/${sorton}/${sortedls}
# using find delete older file # using find delete older file
cd $savepwd/$host cd $projdir/$host
find ${toclean} ! -newer ${dated} ! -name ${dated} -type f -exec rm '{}' ';' find ${toclean} ! -newer ${dated} ! -name ${dated} -type f -exec rm '{}' ';'
done done
cd $savepwd
} }
# README # README
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment