]> git.pld-linux.org Git - packages/postgresql.git/commitdiff
- implement reload without server restart, force-reload not trying to start dead...
authorJakub Bogusz <qboosh@pld-linux.org>
Tue, 19 Feb 2008 21:29:55 +0000 (21:29 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    postgresql.init -> 1.75

postgresql.init

index 727c2751fcd77b6ed38d50d106775079005ab3b2..7eb935a9f420624a72fa96bb86b6da4f8ea6bf68 100644 (file)
@@ -164,6 +164,7 @@ stop() {
        pgsubsys
 }
 
+RETVAL=0
 # See how we were called.
 # Every action is performed for all given (all configured by default)
 # db clusters.
@@ -191,23 +192,36 @@ case "$action" in
        stop
        start
        ;;
-  reload|force-reload)
+  reload|force-reload|try-restart)
+       if [ "$action" = "reload" ]; then
+               # "reload" must not restart service - so let it reload only what's possible
+               pgctlact="reload"
+       else
+               pgctlact="restart"
+       fi
        for pgdir in $DB_CLUSTERS; do
                pgstatus "$pgdir"
                if [ "$PG_STATUS" = "not running" ]; then
                        msg_not_running "PostgreSQL $pgdir"
+                       if [ "$action" != "try-restart" ]; then
+                               RETVAL=7
+                       fi
                else
                        msg_reloading "PostgreSQL $pgdir"
                        busy
                        # is postgresql really alive?
                        if ps -p "$PG_PID" >/dev/null; then
-                               TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $pgdir restart 2>&1 >/dev/null"
+                               TMPDIR=/tmp su postgres -c "/usr/bin/pg_ctl -D $pgdir $pgctlact 2>&1 >/dev/null"
                                        pgstatus "$pgdir"
                                if [ "$PG_STATUS" = "running" ]; then
                                        ok
                                else
                                        fail
                                fi
+                       elif [ "$action" != "try-restart" ]; then
+                               # postgresql died and pg_ctl has misinformed us about
+                               # the status - i.e. service is actually not running
+                               RETVAL=7
                        else
                                # postgresql died and pg_ctl has misinformed us about
                                # the status; remove pid file and start it again
@@ -241,4 +255,4 @@ case "$action" in
        exit 3
 esac
 
-exit 0
+exit $RETVAL
This page took 0.085529 seconds and 4 git commands to generate.