Author: tmckay
Date: 2011-04-04 14:54:46 +0000 (Mon, 04 Apr 2011)
New Revision: 4681
Modified:
trunk/cumin/bin/cumin-database
Log:
Use of condstop was introduced to fix a problem with Postgresql 8.1.22 but
later versions of Postgresql do not have condstop and the script will fail.
Use condrestart instead, which avoids the problem of restarting a stopped
service but will still cause changes by configure to take effect if Postgresql
is already running prior to configure.
Modified: trunk/cumin/bin/cumin-database
===================================================================
--- trunk/cumin/bin/cumin-database 2011-04-01 18:18:01 UTC (rev 4680)
+++ trunk/cumin/bin/cumin-database 2011-04-04 14:54:46 UTC (rev 4681)
@@ -203,15 +203,14 @@
check-initialized || exit 1
# The postgresql 8.1.22 init script violates LSB 3.1 Chapter 20.2,
- # and returns 1 on a successful restart of a stopped service. A
- # proper restart is thus simulated with condstop and start.
+ # and returns 1 on a successful restart of a stopped service.
+ # Use condrestart to skip restart of stopped service.
# Apparently condstop sometimes fails. Try up to 5 times.
- retry "/sbin/service postgresql condstop" 5 || {
+ retry "/sbin/service postgresql condrestart" 5 || {
echo "postgres restart failed"
exit 1
}
- /sbin/service postgresql start
}
function initialize {
@@ -391,10 +390,12 @@
configure)
configure && {
echo "The database server is configured"
- echo -e "\nAfter configuration the server must be restarted."
- echo -e "Would you like to restart the server now?\n"
- get-explicit-confirmation
- restart
+ /sbin/service postgresql status &> /dev/null && {
+ echo -e "\nAfter configuration the server must be restarted."
+ echo -e "Would you like to restart the server now?\n"
+ get-explicit-confirmation
+ restart
+ }
}
;;
create)
Show replies by date