Linux Mint 20.2
Postgresql 9.6.
Steps:
sudo systemctl enable postgresql.service
Result:
Synchronizing state of postgresql.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable postgresql
Then restart service like this:
sudo service postgresql restart
And when check status like this:
service postgresql status
I get this:
postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Wed 2021-08-04 17:33:34 EEST; 47s ago
Process: 29261 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 29261 (code=exited, status=0/SUCCESS)
Why service is EXITED ?
here content of /var/log/postgresql/postgresql-9.6-main.log
2021-08-05 14:59:14.739 EEST [116538] LOG: database system was shut down at 2021-08-05 14:59:13 EEST
2021-08-05 14:59:14.741 EEST [116538] LOG: MultiXact member wraparound protections are now enabled
2021-08-05 14:59:14.746 EEST [116537] LOG: database system is ready to accept connections
2021-08-05 14:59:14.746 EEST [116542] LOG: autovacuum launcher started
2021-08-05 14:59:15.210 EEST [116544] [unknown]@[unknown] LOG: incomplete startup packet
2021-08-05 14:59:55.996 EEST [116537] LOG: received fast shutdown request
2021-08-05 14:59:55.996 EEST [116537] LOG: aborting any active transactions
2021-08-05 14:59:55.997 EEST [116542] LOG: autovacuum launcher shutting down
2021-08-05 14:59:55.998 EEST [116539] LOG: shutting down
2021-08-05 14:59:56.037 EEST [116537] LOG: database system is shut down
2021-08-05 14:59:57.069 EEST [119294] LOG: database system was shut down at 2021-08-05 14:59:56 EEST
2021-08-05 14:59:57.072 EEST [119294] LOG: MultiXact member wraparound protections are now enabled
2021-08-05 14:59:57.073 EEST [119299] LOG: autovacuum launcher started
2021-08-05 14:59:57.073 EEST [119290] LOG: database system is ready to accept connections
2021-08-05 14:59:57.549 EEST [119301] [unknown]@[unknown] LOG: incomplete startup packet
2021-08-05 15:03:46.004 EEST [119290] LOG: received fast shutdown request
2021-08-05 15:03:46.004 EEST [119290] LOG: aborting any active transactions
2021-08-05 15:03:46.004 EEST [119299] LOG: autovacuum launcher shutting down
2021-08-05 15:03:46.005 EEST [119296] LOG: shutting down
2021-08-05 15:03:46.018 EEST [119290] LOG: database system is shut down
2021-08-05 15:03:47.070 EEST [119631] LOG: database system was shut down at 2021-08-05 15:03:46 EEST
2021-08-05 15:03:47.072 EEST [119631] LOG: MultiXact member wraparound protections are now enabled
2021-08-05 15:03:47.074 EEST [119630] LOG: database system is ready to accept connections
2021-08-05 15:03:47.074 EEST [119639] LOG: autovacuum launcher started
2021-08-05 15:03:47.557 EEST [119642] [unknown]@[unknown] LOG: incomplete startup packet
here another command:
pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
9.6 main 5432 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log
one more command:
sudo pg_isready
/var/run/postgresql:5432 - accepting connections
Ubuntu 22.04
sudo apt install -y libpq-dev postgresql postgresql-contrib
Here is the result
$ systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Sun 2022-08-14 14:49:01 CEST; 19min ago
Main PID: 56596 (code=exited, status=0/SUCCESS)
CPU: 5ms
Aug 14 14:49:01 MYHOSTNAME systemd[1]: Starting PostgreSQL RDBMS...
Aug 14 14:49:01 MYHOSTNAME systemd[1]: Finished PostgreSQL RDBMS.
$ psql --version
psql (PostgreSQL) 14.4 (Ubuntu 14.4-0ubuntu0.22.04.1)
$ pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file
14 main 5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ systemctl status postgresql@14-main
● [email protected] - PostgreSQL Cluster 14-main
Loaded: loaded (/lib/systemd/system/[email protected]; enabled-runtime; vendor preset: enabled)
Active: active (running) since Sun 2022-08-14 14:49:01 CEST; 28min ago
Main PID: 56568 (postgres)
Tasks: 7 (limit: 19013)
Memory: 28.8M
CPU: 1.287s
CGroup: /system.slice/system-postgresql.slice/[email protected]
├─56568 /usr/lib/postgresql/14/bin/postgres -D /var/lib/postgresql/14/main -c config_file=/etc/postgresql/14/main/postgresql.conf
├─56570 "postgres: 14/main: checkpointer " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
├─56571 "postgres: 14/main: background writer " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ">
├─56572 "postgres: 14/main: walwriter " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
├─56573 "postgres: 14/main: autovacuum launcher " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
├─56574 "postgres: 14/main: stats collector " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" >
└─56575 "postgres: 14/main: logical replication launcher " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "">
So In your case : systemctl status [email protected] should display postgres active and running
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With