Skip to content

Commit

Permalink
only rm file if it exists (#18310)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmossman authored Oct 21, 2022
1 parent f71fe5a commit 0abc5f6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/bin/load_test/cleanup_load_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ function deleteConnections {
removeFirstLineFromFile $CONNECTION_CLEANUP_FILE
done

if ! test -s $CONNECTION_CLEANUP_FILE
# if file exists and is empty
if test -e $CONNECTION_CLEANUP_FILE && ! test -s $CONNECTION_CLEANUP_FILE
then
rm $CONNECTION_CLEANUP_FILE
echo "removed cleanup file $CONNECTION_CLEANUP_FILE"
Expand All @@ -110,7 +111,8 @@ function deleteSources {
removeFirstLineFromFile $SOURCE_CLEANUP_FILE
done

if ! test -s $SOURCE_CLEANUP_FILE
# if file exists and is empty
if test -e $SOURCE_CLEANUP_FILE && ! test -s $SOURCE_CLEANUP_FILE
then
rm $SOURCE_CLEANUP_FILE
echo "removed cleanup file $SOURCE_CLEANUP_FILE"
Expand All @@ -128,7 +130,8 @@ function deleteDestinations {
removeFirstLineFromFile $DESTINATION_CLEANUP_FILE
done

if test -z $DESTINATION_CLEANUP_FILE
# if file exists and is empty
if test -e $DESTINATION_CLEANUP_FILE && ! test -s $DESTINATION_CLEANUP_FILE
then
rm $DESTINATION_CLEANUP_FILE
echo "removed cleanup file $DESTINATION_CLEANUP_FILE"
Expand Down

0 comments on commit 0abc5f6

Please sign in to comment.