Author: tmckay
Date: 2011-03-28 01:32:32 +0000 (Mon, 28 Mar 2011)
New Revision: 4668
Modified:
trunk/cumin/bin/cumin-database
trunk/cumin/etc/sysvinit-cumin
Log:
Add another run of cumin-database check in startup script on failure
with output left on so that a user has a better idea what is wrong.
Add a retry around condstop of postgresql inside function restart in
cumin-database; postgresql condstop apparently fails sometimes. This causes
the script to exit, leaving the database install incomplete.
Modified: trunk/cumin/bin/cumin-database
===================================================================
--- trunk/cumin/bin/cumin-database 2011-03-25 19:52:13 UTC (rev 4667)
+++ trunk/cumin/bin/cumin-database 2011-03-28 01:32:32 UTC (rev 4668)
@@ -154,7 +154,21 @@
# 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.
- /sbin/service postgresql condstop
+
+ # Apparently condstop sometimes fails. Try up to 5 times.
+ stopped=1
+ for i in 1 2 3 4 5
+ do
+ /sbin/service postgresql condstop && stopped=0
+ if [ $stopped -eq 0 ] ; then
+ break
+ fi
+ sleep 1
+ done
+ if [ $stopped -eq 1 ] ; then
+ echo "postgres restart failed"
+ exit 1
+ fi
/sbin/service postgresql start
}
Modified: trunk/cumin/etc/sysvinit-cumin
===================================================================
--- trunk/cumin/etc/sysvinit-cumin 2011-03-25 19:52:13 UTC (rev 4667)
+++ trunk/cumin/etc/sysvinit-cumin 2011-03-28 01:32:32 UTC (rev 4668)
@@ -21,6 +21,8 @@
}
cumin-database check &> /dev/null || {
+ # Run again with output left on for user.
+ cumin-database check
echo "Cumin's database is not yet installed"
echo "Run 'cumin-database install' as root"
exit 1
Show replies by date