Re: Postmaster failing to start on reboot

From: Richard Huxton <dev(at)archonet(dot)com>
To: "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Postmaster failing to start on reboot
Date: 2005-11-10 09:10:42
Message-ID: 43730E92.2010503@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nicolay A Vasiliev 2005-11-10 09:16:12 PL language selection
Previous Message Maik Trömel 2005-11-10 09:10:22 script