[rhmessaging-commits] rhmessaging commits: r2743 - mgmt/trunk/cumin/bin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Nov 5 15:41:02 EST 2008


Author: justi9
Date: 2008-11-05 15:41:02 -0500 (Wed, 05 Nov 2008)
New Revision: 2743

Modified:
   mgmt/trunk/cumin/bin/cumin-database-destroy
   mgmt/trunk/cumin/bin/cumin-database-init
Log:
Fixes to the database init and destroy scipts

Modified: mgmt/trunk/cumin/bin/cumin-database-destroy
===================================================================
--- mgmt/trunk/cumin/bin/cumin-database-destroy	2008-11-05 15:08:28 UTC (rev 2742)
+++ mgmt/trunk/cumin/bin/cumin-database-destroy	2008-11-05 20:41:02 UTC (rev 2743)
@@ -1,11 +1,12 @@
-#!/bin/bash
+#!/bin/bash -e
 
 # This script assumes that postgresql is configured and running
 
-if [ "$EUID" -ne "0" ]; then
+if [[ "$EUID" != "0" ]]; then
     echo "This script must be run as root"
     exit 2
 fi
 
-su - postgres -c "dropdb cumin"
-su - postgres -c "dropuser cumin"
+su - postgres -c "psql -c '\q'"
+su - postgres -c "dropdb cumin 2> /dev/null || :"
+su - postgres -c "dropuser cumin 2> /dev/null || :"

Modified: mgmt/trunk/cumin/bin/cumin-database-init
===================================================================
--- mgmt/trunk/cumin/bin/cumin-database-init	2008-11-05 15:08:28 UTC (rev 2742)
+++ mgmt/trunk/cumin/bin/cumin-database-init	2008-11-05 20:41:02 UTC (rev 2743)
@@ -1,19 +1,20 @@
-#!/bin/bash
+#!/bin/bash -e
 
 # This script assumes that postgresql is configured and running
 
-if [ "$EUID" -ne "0" ]; then
+if [[ "$EUID" != "0" ]]; then
     echo "This script must be run as root"
-    exit 2
+    exit 1
 fi
 
-su - postgres -c "createuser --superuser cumin"
-su - postgres -c "createdb --owner=cumin cumin"
+su - postgres -c "psql -c '\q'"
+su - postgres -c "createuser --superuser cumin 2> /dev/null || :"
+su - postgres -c "createdb --owner=cumin cumin 2> /dev/null || :"
 
 cumin-admin check-schema | grep -e '^OK '
 
-if [ "$?" = 0 ]; then
+if [[ "$?" == "0" ]]; then
     echo "Not creating schema; it already exists"
 else
-    cumin-admin --force 1 create-schema
+    cumin-admin create-schema
 fi




More information about the rhmessaging-commits mailing list