Skip to content

Commit

Permalink
Add verification before deleting LOGDIR contents
Browse files Browse the repository at this point in the history
I had no files in the ${LOGDIR}, which caused rm ${LOGDIR}/* to fail
Added a verification: only attempt deletion, if there are files in the folder
  • Loading branch information
kirilstrax committed Jul 12, 2015
1 parent 3986094 commit 2196389
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/launchdev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ function st2clean(){
mongo st2 --eval "db.dropDatabase();"
# start with clean logs
LOGDIR=$(dirname $0)/../logs
rm ${LOGDIR}/*
if [ "$(ls -A ${LOGDIR} | wc -l)" != "0" ]; then
rm ${LOGDIR}/*
fi
if [ -n "$ST2_EXPORTER" ]; then
EXPORTS_DIR=$(exportsdir)
echo "Removing $EXPORTS_DIR..."
Expand Down

0 comments on commit 2196389

Please sign in to comment.