I want to run PostgreSQL 9.1 using Supervisor on Ubuntu 10.04. At the moment, I manually start PostgreSQL using the init script:
/etc/init.d/postgresql start
To avoid auto-starting the service with the /etc/init.d
scripts, the package for postgresql 9.1 provides a file /etc/postgresql/9.1/main/start.conf
that contains:
# Automatic startup configuration # auto: automatically start/stop the cluster in the init script # manual: do not start/stop in init scripts, but allow manual startup with # pg_ctlcluster # disabled: do not allow manual startup with pg_ctlcluster (this can be easily # circumvented and is only meant to be a small protection for # accidents). auto
This is the file to modify to avoid auto-start as opposed to moving away /etc/init.d/postgresql
as the blog post suggests.
Also, changing unix sockets parameters for lack of /var/run/postgresql
doesn't look like the best idea, because it's the default for any program linked with libpq, and because there's no difficulty in creating that directory with the proper permissions, just like it's done by the package's start sequence in /usr/share/postgresql-common/init.d-functions
:
# create socket directory
if [ -d /var/run/postgresql ]; then
chmod 2775 /var/run/postgresql
else
install -d -m 2775 -o postgres -g postgres /var/run/postgresql
fi
And although the default value shouldn't cause a problem, note that whether postmaster
ultimately stays in foreground or forks and runs in background is controlled by the silent_mode parameter in postgresql.conf
. Make sure that it is off.