Re: automatic restart on reboot

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: "Aurangzeb M(dot) Agha" <aagha(at)bigfoot(dot)com>
Cc: PostgreSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: automatic restart on reboot
Date: 2003-01-13 16:38:51
Message-ID: Pine.LNX.4.33.0301130936200.14202-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 12 Jan 2003, Aurangzeb M. Agha wrote:

> I'm deploying Postgres on a production environment and wanted to know if
> people could share what steps they've taken to have their DB's come back
> up on system reboot (either on purpose or accidental).
>
> Are there any things to check for?
>
> What about postmaster.pid, /tmp/blah..., etc... Any script examples would
> be appreciated.

I added the following lines to the /etc/rc.d/rc.local script:

rm -f /db/data/postmaster.pid
raidstart /dev/md0
mount /dev/md0 /mnt/db
su - postgres -c 'pg_ctl start | rotatelogs $PGDATA/pglog 86400 2>1&'

So, I make sure the old postmaster.pid is gone (since we're booting when
we run rc.local, it's safe to assume that any old postmaster.pid is left
over from a crash.) Then I start the RAID array just in case it didn't
get started earlier, and mount it before running postgresql. The outputs
of postgresql are then piped into apache's rotatelogs command to get me
daily rotated logs from postgresql. Note that you need to have the path
to rotatelogs in postgres's path, or refer to it fully qualified to make
that work right.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pirtea Calin Iancu 2003-01-13 16:44:35 Re: PostgreSQL on Windows
Previous Message Larry Rosenman 2003-01-13 16:27:36 DNS for POSTGRESQL.ORG