HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlCritical

Preventing PostgreSQL from starting on boot in Ubuntu

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
postgresqlstartingbootubuntupreventingfrom

Problem

I am using PostgreSQL 9.2 and it runs automatically when I start the system (Kubuntu).

How can I avoid this?

I need to start it manually, and I don't want it to start unattended because I need to look at the console.

Solution

Ubuntu or Debian can run multiple instances of PostgreSQL and provide a specific way to autostart/stop/start each cluster.

There should be a file named start.conf inside /etc/postgresql/9.2/main (or more generally /etc/postgresql//) with these self-explanatory contents:

# 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

If you replace auto by manual, you could start this PostgreSQL instance only when desired with the command:

sudo pg_ctlcluster 9.2 main start


As for looking at the console, what you should want instead is having this run in a terminal when you work with the database:

tail -f /var/log/postgresql/postgresql-9.2-main.log

Code Snippets

sudo pg_ctlcluster 9.2 main start
tail -f /var/log/postgresql/postgresql-9.2-main.log

Context

StackExchange Database Administrators Q#31210, answer score: 51

Revisions (0)

No revisions yet.