Re: Autostart PostgreSQL in Ubuntu

From: Carlos Moreno <moreno_pg(at)mochima(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Autostart PostgreSQL in Ubuntu
Date: 2007-09-26 15:35:14
Message-ID: 46FA7C32.7000407@mochima.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Johann Maar wrote:
> But if I try to start PostgreSQL by running "sudo /etc/init.d/
> postgresql start" it will fail because it tries to write a PID file to
> "/var/run/postgresql" which does not exist. If I create this directory
> and set the permissions for postgres to write it works (!), but after
> the next restart of the machine the directory is already gone.

With Red Hat systems, you would do chkconfig postgresql on if you
installed
the postgresql that they distribute.

On Ubuntu (and I imagine with all Debian-based systems), AFAIK you have
to manually adjust the init scripts for the runlevels that you want.
Assuming
that you want postgresql started at runlevels 3 and 5, there should be
symlinks
in /etc/rc3.d and /etc/rc5.d pointing to /etc/init.d/postgresql (so
that the boot
sequence runs /etc/init.d/postgresql start for you --- so to speak)

These symlinks should be named S??postgresql (where ?? is a two-digit
code that indicates the order in which the service is started --- maybe
99 or
some high number would be convenient, so that it is started after other
services like networking).

A ls -l /etc/rc?.d should help you visualize what you need to do. If
you're
not familiar at all with all this, do a search on runlevels and init
scripts; I'm
sure you'll find plenty of documents/tutorials out there.

Or.... The big, "brute force" hammer, would be to add a line in the
/etc/rc.local file with the very command that you're running to start it
(without sudo, of course, since that'a already being run by root)

HTH,

Carlos
--

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2007-09-26 15:37:00 Re: Dumping from older version
Previous Message Jimmy Choi 2007-09-26 15:31:41 Re: Help tuning a large table off disk and into RAM