Re: How to implement autostart of postgres?

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: "Gavrina, Irina" <igavrina(at)mera(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to implement autostart of postgres?
Date: 2011-07-21 03:36:07
Message-ID: 4E279EA7.8010904@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 20/07/11 19:02, Gavrina, Irina wrote:
> Hello All,
>
>
>
> I’ve faced with the following problem: I’m trying to implement the auto start of postgres. My way is to use inittab:
>
> pg:2345:respawn:/bin/su - postgres -c "/usr/local/pgsql/bin/postmaster

Are you working on some kind of embedded platform?

For any modern Linux or UNIX, the init subsystem takes care of this with
init scripts. Newer Linux systems use `upstart' or `systemd' instead of
old-style sysv init; these newer init systems support init "scripts"
that can monitor and re-start processes. See the upstart and systemd
documentation.

If you're trying to re-start the postmaster when it exits, the bigger
question is: why is it exiting? It shouldn't be, and that's what you
need to fix.

Typically you'd just start the postmaster at boot and leave it running.
If you want system self-healing and recovery, there are existing
monitoring solutions like nagios that support running scripts when
certain kinds of failures appear. Be aware, though, that if the
postmaster has exited then something is already wrong, and trying to
just re-start it might mask a problem and prevent you from finding out
about it until it is much worse.

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sofer, Yuval 2011-07-21 06:56:51 Re: compile postgres with visual studio 2010
Previous Message Craig Ringer 2011-07-21 03:32:15 Re: custom system catalog table names