Author: tmckay
Date: 2010-10-08 11:27:58 -0400 (Fri, 08 Oct 2010)
New Revision: 4375
Modified:
mgmt/trunk/cumin/bin/cumin-database
Log:
Tweaks to the script, functionality is essentially unchanged.
Modified: mgmt/trunk/cumin/bin/cumin-database
===================================================================
--- mgmt/trunk/cumin/bin/cumin-database 2010-10-08 14:40:01 UTC (rev 4374)
+++ mgmt/trunk/cumin/bin/cumin-database 2010-10-08 15:27:58 UTC (rev 4375)
@@ -163,18 +163,18 @@
# Try initdb first, and if it fails try start followed by stop. This
# should leave the database and the service in the same state on all
# 8.x versions of Postgres.
- set +e
echo -e "\nAttempting to use initdb option..."
- run "/sbin/service postgresql initdb"
- if [ $? -ne 0 ]; then
+ run "/sbin/service postgresql initdb" || {
echo -e "\ninitdb option not supported, using start..."
run "/sbin/service postgresql start"
run "/sbin/service postgresql stop"
- fi
+ }
# now check again, to make sure one of the two methods worked
- check-initialized &> /dev/null || { echo "Database initialization
failed."; exit 1; }
- set -e
+ check-initialized &> /dev/null || {
+ echo "Error: Database initialization failed."
+ exit 1
+ }
}
function configure {
Show replies by date