0
votes

I installed posgresql from digitalocean and in the end of installation prints the below command in terminal

/usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start

I tried to run it with sudo root user and also with switching to postgres user but gives me below error

waiting for server to start..../bin/sh: 1: cannot create logfile: Permission denied stopped waiting pg_ctl: could not start server but when i check the status it says ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Thu 2018-05-31 13:11:18 UTC; 56s ago Main PID: 3698 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 2362) CGroup: /system.slice/postgresql.service

May 31 13:11:18 staging systemd1: Starting PostgreSQL RDBMS... May 31 13:11:18 staging systemd1: Started PostgreSQL RDBMS.

Status is not running except is exited.what the above command do and how can i run it ? I haven't faced it in previous versions

1

1 Answers

0
votes

The idea is that you supply your actual log file instead of logfile, but I recommend that you configure logging properly in postgresql.conf and use pg_ctl without the -l option.

  • Set logging_collector to on.
  • Set log_filename to postgresql-%a.log.
  • Set log_rotation_size to 0.
  • Set log_truncate_on_rotation to on.

Then you'll get the log files in the log subdirectory of your PostgreSQL data directory, and they will be rotated on a weekly basis.