Check file for zero size

This commit is contained in:
Bob Mottram 2017-11-23 18:27:03 +00:00
parent 8e3a997fcb
commit 80c95b9b80
1 changed files with 2 additions and 2 deletions

View File

@ -103,8 +103,7 @@ function remove_mongodb {
removemongo= removemongo=
if [ -f $MONGODB_APPS_FILE ]; then if [ -f $MONGODB_APPS_FILE ]; then
sed -i "/$app_name/d" $MONGODB_APPS_FILE sed -i "/$app_name/d" $MONGODB_APPS_FILE
mongoapps=$(cat $MONGODB_APPS_FILE) if [ ! -s $MONGODB_APPS_FILE ]; then
if [ ${#mongoapps} -lt 3 ]; then
removemongo=1 removemongo=1
fi fi
else else
@ -113,6 +112,7 @@ function remove_mongodb {
if [ $removemongo ]; then if [ $removemongo ]; then
apt-get -yq remove mongodb mongo-tools apt-get -yq remove mongodb mongo-tools
apt-get -yq autoremove
if [ -d /var/lib/mongodb ]; then if [ -d /var/lib/mongodb ]; then
rm -rf /var/lib/mongodb rm -rf /var/lib/mongodb
fi fi