Skip site navigation (1) Skip section navigation (2)

Re: Logging the starting and stopping of PostgreSQL

From: Chander Ganesan <chander(at)otg-nc(dot)com>
To: "Campbell, Lance" <lance(at)uiuc(dot)edu>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Logging the starting and stopping of PostgreSQL
Date: 2007-08-23 21:59:44
Message-ID: 46CE0350.20604@otg-nc.com (view raw or flat)
Thread:
Lists: pgsql-admin
Campbell, Lance wrote:
>
> I have a script that starts PostgreSQL as a service.  It uses the 
> following command to start the database:
>
>  
>
> $SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -D '$PGDATA' 
> ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null
>
You do know that there is a pre-built startup script in the 
contrib/start-scripts directory?   You might try using that rather than 
reinventing the wheel in a variety of ways...
>
>  
>
> On my production server I use a slightly different command:
>
>  
>
> exec ${PGENGINE}/pg_ctl start  -D ${PGDATA}  -l ${PGLOG}
>
>  
>
> I noticed that the first command sends starting up info about 
> PostgreSQL to the log file specified by $PGLOG; while the second 
> startup command does not send anything to the log file.  What is the 
> reason for this?  I also have the same issue with shutting down.
>
It looks like in your first startup script you redirect the output so 
the startup script is created by the user "root" (and hence owned by 
root).  In the second one, you start as postgres (or whomever your 
server runs as), and as a result the log file would have to be owned by 
that user as well.  Is it?  I'm assuming that (by your text above) that 
the file already exists but no new output appears there - this may be 
because the file is owned by the root user.  You should probably change 
the ownership of the file so that the postgresql user can write to it.

hope that helps.

-- 
Chander Ganesan
The Open Technology Group
One Copley Parkway, Suite 210
Morrisville, NC  27560
Phone: 877-258-8987/919-463-0999
http://www.otg-nc.com
Expert PostgreSQL Training

In response to

Responses

pgsql-admin by date

Next:From: Kenji MorishigeDate: 2007-08-23 23:54:52
Subject: Warm-Backup configuration question
Previous:From: Campbell, LanceDate: 2007-08-23 19:38:08
Subject: Re: Installing Postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group