Prompt user to remove old PG backup data cluster.
authorGuo Xiang Tan <tgx_world@hotmail.com>
Tue, 17 Apr 2018 05:55:02 +0000 (13:55 +0800)
committerGuo Xiang Tan <tgx_world@hotmail.com>
Tue, 17 Apr 2018 05:55:55 +0000 (13:55 +0800)
launcher

index 97ea53577e132d48c93ea2343c34b18193fcad0e..9d44cda60c851be6d2efe8a03827554898021030 100755 (executable)
--- a/launcher
+++ b/launcher
@@ -406,6 +406,20 @@ fi
     else
       exit 1
   fi
+
+  if [ -d /var/discourse/shared/standalone/postgres_data_old ]; then
+    echo
+    echo "Old PostgreSQL backup data cluster detected taking up $(du -hs /var/discourse/shared/standalone/postgres_data_old | awk '{print $1}') detected"
+    read -p "Would you like to remove it? (Y/n): " -n 1 -r && echo
+
+    if [[ $REPLY =~ ^[Yy]$ ]]; then
+      echo "removing old PostgreSQL data cluster at /var/discourse/shared/standalone/postgres_data_old..."
+      rm -rf /var/discourse/shared/standalone/postgres_data_old
+    else
+      exit 1
+    fi
+  fi
+
   exit 0
 }