You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2014/03/14 20:06:37 UTC
git commit: Fix clean.sh to clean the host when there is no DBs to
clean, e.g. MB run in single host
Repository: incubator-stratos
Updated Branches:
refs/heads/master 75fc3a559 -> 418421d2e
Fix clean.sh to clean the host when there is no DBs to clean, e.g. MB run in single host
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/418421d2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/418421d2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/418421d2
Branch: refs/heads/master
Commit: 418421d2e5327c9ae28ff92a8c4ce12807fd1343
Parents: 75fc3a5
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Fri Mar 14 12:06:22 2014 -0700
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Fri Mar 14 12:06:22 2014 -0700
----------------------------------------------------------------------
tools/stratos-installer/clean.sh | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/418421d2/tools/stratos-installer/clean.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-installer/clean.sh b/tools/stratos-installer/clean.sh
old mode 100755
new mode 100644
index f00014b..5692739
--- a/tools/stratos-installer/clean.sh
+++ b/tools/stratos-installer/clean.sh
@@ -49,23 +49,24 @@ do
;;
*)
help
- exit 1
+ #exit 1
;;
esac
done
function helpclean {
echo ""
+ echo "Enter DB credentials if you need to clear Stratos DB"
echo "usage:"
echo "clean.sh -u <mysql username> -p <mysql password>"
echo ""
}
function clean_validate {
- if [[ ( -z $mysql_user || -z $mysql_pass ) ]]; then
- helpclean
- exit 1
- fi
+# if [[ ( -z $mysql_user || -z $mysql_pass ) ]]; then
+ # helpclean
+ # exit 1
+ # fi
if [ -z $stratos_path ]; then
echo "stratos_path is not set"
exit 1
@@ -77,22 +78,26 @@ function clean_validate {
}
clean_validate
-
-read -p "Please confirm that you want to remove stratos databases, servers and logs [y/n] " answer
-if [[ $answer != y ]] ; then
- exit 1
+if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
+ read -p "Please confirm that you want to remove stratos databases, servers and logs [y/n] " answer
+ if [[ $answer != y ]] ; then
+ exit 1
+ fi
fi
-
echo 'Stopping all java processes'
killall java
echo 'Waiting for applications to exit'
sleep 15
-echo 'Removing stratos_foundation database'
-mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS stratos_foundation;"
+if [[ ( -n $mysql_user && -n $mysql_pass ) ]]; then
-echo 'Removing userstore database'
-mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS userstore;"
+ echo 'Removing stratos_foundation database'
+ mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS stratos_foundation;"
+
+ echo 'Removing userstore database'
+ mysql -u $mysql_user -p$mysql_pass -e "DROP DATABASE IF EXISTS userstore;"
+
+fi
if [[ -d $stratos_path/scripts ]]; then
echo 'Removing scripts'
@@ -126,4 +131,3 @@ fi
echo 'Removing logs'
rm -rf $log_path/*
-