Skip to content

Commit 0abc5f6

Browse files
authored
only rm file if it exists (#18310)
1 parent f71fe5a commit 0abc5f6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/bin/load_test/cleanup_load_test.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ function deleteConnections {
9292
removeFirstLineFromFile $CONNECTION_CLEANUP_FILE
9393
done
9494

95-
if ! test -s $CONNECTION_CLEANUP_FILE
95+
# if file exists and is empty
96+
if test -e $CONNECTION_CLEANUP_FILE && ! test -s $CONNECTION_CLEANUP_FILE
9697
then
9798
rm $CONNECTION_CLEANUP_FILE
9899
echo "removed cleanup file $CONNECTION_CLEANUP_FILE"
@@ -110,7 +111,8 @@ function deleteSources {
110111
removeFirstLineFromFile $SOURCE_CLEANUP_FILE
111112
done
112113

113-
if ! test -s $SOURCE_CLEANUP_FILE
114+
# if file exists and is empty
115+
if test -e $SOURCE_CLEANUP_FILE && ! test -s $SOURCE_CLEANUP_FILE
114116
then
115117
rm $SOURCE_CLEANUP_FILE
116118
echo "removed cleanup file $SOURCE_CLEANUP_FILE"
@@ -128,7 +130,8 @@ function deleteDestinations {
128130
removeFirstLineFromFile $DESTINATION_CLEANUP_FILE
129131
done
130132

131-
if test -z $DESTINATION_CLEANUP_FILE
133+
# if file exists and is empty
134+
if test -e $DESTINATION_CLEANUP_FILE && ! test -s $DESTINATION_CLEANUP_FILE
132135
then
133136
rm $DESTINATION_CLEANUP_FILE
134137
echo "removed cleanup file $DESTINATION_CLEANUP_FILE"

0 commit comments

Comments
 (0)