PostgreSQL: View and restart postgreSQL under Linux.

View command

ps aux | grep postgres
netstat -npl | grep postgres

method 1

#su - postgres   

$pg_ctl restart

Method 2

#su - postgres   

Check your own postgresql version, just change the following version.

For example: my version is 9.5, directly change the following postgresql-9.4.service to postgresql-9.5.service and it will be ok

Exit bash

CTRL+D

Start service

systemctl start  postgresql-9.4.service

Out of service

systemctl stop postgresql-9.4.service

Restart service

systemctl restart postgresql-9.4.service

View the status of a service

systemctl status postgresql-9.4.service

Enable a service at boot

systemctl enable postgresql-9.4.service

Turn off a service at boot

systemctl disable postgresql-9.4.service

Check whether the service is started

systemctl is-enabled postgresql-9.4.service

 

Guess you like

Origin blog.csdn.net/en_joker/article/details/108072667