Re: Postmaster failing to start on reboot - Mailing list pgsql-general

From Richard Huxton
Subject Re: Postmaster failing to start on reboot
Date
Msg-id 43730E92.2010503@archonet.com
Whole thread Raw
In response to Re: Postmaster failing to start on reboot  ("surabhi.ahuja" <surabhi.ahuja@iiitb.ac.in>)
Responses Re: Postmaster failing to start on reboot  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
surabhi.ahuja wrote:
> i am using PostgreSQL 8.0.0

You should upgrade to 8.0.4 as soon as is convenient - there are 4 sets
of bugfixes available.

> and the statrtup script i am using is as follows:
>
>
> *****
> #! /bin/sh
> # dbxd    Script for starting up the PostgreSQL
> #               server in the daemon mode
> #
> #
>
> # postgreSQL version is:
> PGVERSION=8.0
> # Name of the script
> NAME=dbxd
> # Command issued start/stop/restart
> action="$1"
> # Get SDC configiration
> #   . $SDCHOME/.SdCrc

I don't recognise this script. Can I ask two questions:

Q1. What distribution of Linux are you running?
Q2. How did you install PostgreSQL?
Q3. Have you made any changes to this script?

In another email you mention that this script sometimes doesn't stop PG.
This is the relevant block of code, and you can see that the line
starting "su -l postgres" has been commented out and replaced.

That's strange, because my copy of pg_ctl refuses to run as root.

> stop(){
>         echo "Stopping ${NAME} service: "
>         if [ "`uname`" = "Linux" ]; then
>            #su -l postgres -s /bin/sh -c "$PGCTL stop -D $PGDATA -s -m fast" > /dev/null 2>&1
>            /bin/sh -c "$PGCTL stop -D $PGDATA -s -m fast" > /dev/null 2>&1
>         fi
>        ret=$?
>         if [ $ret -eq 0 ]
>         then
>                 #echo "success"
>                 echo_success
>         else
>                 echo_failure
>                 if [ "`uname`" = "Linux" ]; then
>                    #su -l postgres -s /bin/sh -c "$PGCTL stop -D $PGDATA -s -m immediate" > /dev/null 2>&1
>                    /bin/sh -c "$PGCTL stop -D $PGDATA -s -m immediate" > /dev/null 2>&1
>                 fi
>         fi
>         echo
> }


> Please see the highlighted section (in red) .

Most people will be viewing this in text-mode (including me). They won't
see the red. It appears to be deleting the unix socket and lock *AFTER*
starting up PG. I don't understand how that makes sense.

Q4. Where did you get this script?

 > do i also need to remove the pid file also .

What, after starting PG? How could that make sense?

 > i mean with the other rm commands do i need to give
 > rm -f $PGDATA /postmaster.pid also?

The standard script should start and stop PostgreSQL quite successfully.
If it isn't working the first place to look is your logs.
--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Dynamic web sites with PostgreSQL
Next
From: "Andrus"
Date:
Subject: Re: Best way to use indexes for partial match at