Re: Re: how to set up automatically startup database when the server boot or reboot.

From: Michael Nolan <htfoot(at)gmail(dot)com>
To: leaf_yxj <leaf_yxj(at)163(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: how to set up automatically startup database when the server boot or reboot.
Date: 2012-04-27 18:03:19
Message-ID: CAOzAquKHkK9ochM3bEo2FTKRCLYutGCOkAkE40Y_SKoOCzVh0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Your options range from doing something simple to something complex.

A simple option on a Linux server would be placing a command like this in
/etc/rc/rc.local:

su - postgres -C "/usr/local/pgsql/bin/pg_ctl -D ;/usr/local/pgsql/data -l
/usr/local/pgsql/logfile start"

However, that might not be the optimal choice for every situation, because
it doesn't take into account WHY the system rebooted. A system that
rebooted because of a power/UPS issue might need to be treated differently
than one that rebooted because of a hardware failure or kernel panic. (And
just because postgres can restart the database, that doesn't always mean it
should. Even a well-written startup script might not know enough to make
that decision for you.)

This might be good material for a tutorial on the wiki site, with some
system-specific sections.
--
Mike Nolan

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Filip Rembiałkowski 2012-04-27 18:11:28 Re: empty role names in pg_dumpall output
Previous Message hb@101-factory.eu 2012-04-27 18:01:26 Re: Re: how to set up automatically startup database when the server boot or reboot.