[Note] Start/Stop PostgreSQL on Linux

Start and Stop the PostgreSQL Service

Last update April 28, 2017

To start or stop the PostgreSQL service, you must first log in to the computer as a user that has access to the PostgreSQL directory. By default, the user is postgres.

Note: If you are logged in as a different user and you want to switch to the postgres user, run this command su – postgres.

You must also set the PGDATA environment variable to the PostgreSQL/data directory:

export PGDATA=CAWA_HOME/PostgreSQL/data

  • CAWA_HOME
    Specifies the server installation directory.

Start the PostgreSQL Service

To start the PostgreSQL service, change to the PostgreSQL/bin directory from the command prompt and run the following command:

./pg_ctl start

Stop the PostgreSQL Service

To start the PostgreSQL service, change to the PostgreSQL/bin directory from the command prompt and run the following command:

./pg_ctl stop

export PGDATA=/opt/PostgreSQL/9.5/data

cd /opt/PostgreSQL/9.5/bin/

su postgres

./pg_ctl stop

https://docops.ca.com/ca-workload-automation-de/12-0/en/administrating/controlling/start-and-stop-the-postgresql-service