Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
318c2fa4
Commit
318c2fa4
authored
Nov 03, 2014
by
Dan Reading
Browse files
in cleanup_main cd to the inventory directory for check for //
parent
18adae3a
Changes
1
Show whitespace changes
Inline
Side-by-side
clientside/tmcc/common/checknode/gen_sql
View file @
318c2fa4
...
...
@@ -121,14 +121,15 @@ cleanup_main() {
savepwd
=
$(
pwd
)
sorton
=
".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
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
}
[[
!
-d
$
projdir
/
$host
/
${
sorton
}
]]
&&
continue
cd
$
projdir
/
$host
/
${
sorton
}
sortedls
=
$(
ls
-t
|
paste
-s
-d
\\\
-
)
# pop the top 2 newest off
sortedls
=
${
sortedls
#*\
}
...
...
@@ -148,11 +149,12 @@ cleanup_main() {
# take the next file for timestamp
sortedls
=
${
sortedls
%%\ *
}
[[
-z
"
$sortedls
"
]]
&&
continue
dated
=
$
savepwd
/
$host
/
${
sorton
}
/
${
sortedls
}
dated
=
$
projdir
/
$host
/
${
sorton
}
/
${
sortedls
}
# using find delete older file
cd
$
savepwd
/
$host
cd
$
projdir
/
$host
find
${
toclean
}
!
-newer
${
dated
}
!
-name
${
dated
}
-type
f
-exec
rm
'{}'
';'
done
cd
$savepwd
}
# README
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment