According to pg_lsclusters I have 2 servers running on Ubuntu 14.04:

    Ver Cluster Port Status Owner    Data directory               Log file
    9.1 main    5432 online postgres /var/lib/postgresql/9.1/main /var/log/postgresql/postgresql-9.1-main.log
    9.3 main    5433 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log

What is the easiest way of shutting down the 9.1 server forever?


    $/usr/lib/postgresql/9.1/bin/pg_ctl stop

I get the error:

    pg_ctl: kein Datenbankverzeichnis angegeben und Umgebungsvariable PGDATA nicht gesetzt

(no database directory given and environment variable PGDATA not set)

What is the meaning of this error?

  • 1
    Well as the error message says: you need to specify the data directory using the -D switch. Alternatively I think using service postgresql-9.3 stop should also work (the service name might be different though) – a_horse_with_no_name May 9 '14 at 13:48
  • 1
    "What is the easiest way of shutting down the 9.1 server forever?" - Dynamite? – Max Vernon May 9 '14 at 14:16

I decided to go the route of a fresh install. So instead of trying to figure out what postgresql-command will shut down the server I used:

   sudo apt-get purge postgresql-9.1


   sudo apt-get purge postgresql-9.3

A fresh install might be an easier solution to some of my other problems I had since upgrading to Ubuntu 14.04.

I found this at:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.