pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Logging the starting and stopping of PostgreSQL
3+ messages / 2 participants
[nested] [flat]

* Logging the starting and stopping of PostgreSQL
@ 2007-08-23 19:17  Campbell, Lance <lance@uiuc.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: Campbell, Lance @ 2007-08-23 19:17 UTC (permalink / raw)
  To: pgsql-admin

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

 

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.

 

Thanks,

 

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu

 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Logging the starting and stopping of PostgreSQL
@ 2007-08-23 21:59  Chander Ganesan <chander@otg-nc.com>
  parent: Campbell, Lance <lance@uiuc.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: Chander Ganesan @ 2007-08-23 21:59 UTC (permalink / raw)
  To: Campbell, Lance <lance@uiuc.edu>; +Cc: 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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Logging the starting and stopping of PostgreSQL
@ 2007-08-24 16:27  Campbell, Lance <lance@uiuc.edu>
  parent: Chander Ganesan <chander@otg-nc.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Campbell, Lance @ 2007-08-24 16:27 UTC (permalink / raw)
  To: Chander Ganesan <chander@otg-nc.com>; +Cc: pgsql-admin

Ganesan,

Thanks so much.  I never read about that directory.

 

Thanks,

 

Lance Campbell

Project Manager/Software Architect

Web Services at Public Affairs

University of Illinois

217.333.0382

http://webservices.uiuc.edu

 

________________________________

From: Chander Ganesan [mailto:chander@otg-nc.com] 
Sent: Thursday, August 23, 2007 5:00 PM
To: Campbell, Lance
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Logging the starting and stopping of PostgreSQL

 

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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-08-24 16:27 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-08-23 19:17 Logging the starting and stopping of PostgreSQL Campbell, Lance <lance@uiuc.edu>
2007-08-23 21:59 ` Chander Ganesan <chander@otg-nc.com>
2007-08-24 16:27   ` Campbell, Lance <lance@uiuc.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox