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
--
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org/