Re: Problems With New Installation

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pdxpug(at)postgresql(dot)org
Subject: Re: Problems With New Installation
Date: 2009-01-25 21:21:45
Message-ID: alpine.LNX.2.00.0901251247490.29851@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

On Sun, 25 Jan 2009, M. Edward (Ed) Borasky wrote:

> I should probably build a Slackware virtual machine so I can see where the
> PostgreSQL log files end up. :) If there aren't log files, you can
> probably edit the scripts and capture them.

Let me reiterate. Postgres-8.3.3 (and all the earlier versions since 6.x)
have installed and run just fine on my servers. This issue now is with
-8.3.5 on my notebook.

There's nothing in /var/log/postgresql.

When I try to start the server (using '/etc/rc.d/rc.postgresql start')
this is displayed:

Starting PostgreSQL
2764
PostgreSQL daemon already running

This from a fresh boot of the notebook and postgres not starting
automatically. There's still nothing in /var/log/postgresql.

Now, when I stop the server ('/etc/rc.d/rc.postgreql stop') this is
displayed on the console:

Shutting down PostgreSQL...
No directory, logging in with HOME=/
pg_ctl: invalid data in PID file "/var/lib/pgsql/data/postmaster.pid"

The PID file is empty; I created it by touching it. So, if I remove that
.pid file and try starting the server, rather than creating that file I see
the same three lines as above with a new fourth line that reads,

Warning: Missing pid file /var/lib/pgsql/data/postmaster.pid

Checkmate. And, after stopping the server I run '/etc/rc.d/rc.postgresql
status' I see:

2801
PostgreSQL is running
Warning: Missing pid file /var/lib/pgsql/data/postmaster.pid

More importantly, a look at running processes ('ps ax') reveals there is no
process ID 2801. The list jumps from 2789 to 2805.

Here's the top of /etc/rc.d/rc.postgresql with comments removed:

LOGFILE=/var/log/postgresql
DATADIR=/var/lib/pgsql/data
POSTGRES=/usr/bin/postgres
PIDFILE=postmaster.pid

# Return values (according to LSB):
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running

pg_ctl()
{
CMD="/usr/bin/pg_ctl $@"
su - postgres -c "$CMD"
}

if [ ! -f $POSTGRES ]; then
echo "Could not find 'postgres' binary. Maybe PostgreSQL is not installed properly?"
exit 5
fi

case "$1" in

"start")
echo "Starting PostgreSQL"
touch $LOGFILE
chown postgres:wheel $LOGFILE
chmod 0640 $LOGFILE

if [ ! -e $DATADIR/PG_VERSION ]; then
echo "You should initialize the PostgreSQL database at location $DATADIR"
exit 6
fi

if pgrep postgres; then

echo "PostgreSQL daemon already running"
if [ ! -f $DATADIR/$PIDFILE ]; then
echo "Warning: Missing pid file $DATADIR/$PIDFILE"
fi
exit 1

else # remove old socket, if it exists and no daemon is running.

if [ ! -f $DATADIR/$PIDFILE ]; then
rm -f /tmp/.s.PGSQL.5432
rm -f /tmp/.s.PGSQL.5432.lock
# pg_ctl start -w -l $LOGFILE -D $DATADIR
su postgres -c 'postgres -D /var/lib/pgsql/data &'
exit 0
else
echo "PostgreSQL daemon was not properly shut down"
echo "Please remove stale pid file $DATADIR/$PIDFILE"
exit 7
fi

fi
;;

HTH,

Rich

--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message Jon Scully 2009-01-25 22:46:48 Re: Problems With New Installation
Previous Message Rich Shepard 2009-01-25 14:36:36 Re: Problems With New Installation