all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 45588@debbugs.gnu.org
Subject: [bug#45588] [PATCH] services: postgresql: Log from pg_ctl.
Date: Fri,  1 Jan 2021 10:10:15 +0000	[thread overview]
Message-ID: <20210101101015.6524-1-mail@cbaines.net> (raw)

pg_ctl will output errors when starting PostgreSQL, for example about errors
in the configuration file. Without getting pg_ctl to log to a file, I'm not
sure how to find those errors.

* gnu/services/databases.scm (postgresql-activation): Create
/var/log/postgresql.
(postgresql-shepherd-service): Pass --log=/var/log/postgresql/pg_ctl to
pg_ctl.
---
 gnu/services/databases.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index d2dc5f0da8..479a3c56f7 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -205,6 +205,10 @@ host	all	all	::1/128 	md5"))
            (mkdir-p #$data-directory)
            (chown #$data-directory (passwd:uid user) (passwd:gid user))
 
+           ;; Create log directory
+           (mkdir-p "/var/log/postgresql")
+           (chown "/var/log/postgresql" (passwd:uid user) (passwd:gid user))
+
            ;; Drop privileges and init state directory in a new
            ;; process.  Wait for it to finish before proceeding.
            (match (primitive-fork)
@@ -247,6 +251,7 @@ host	all	all	::1/128 	md5"))
                        (setgid (passwd:gid user))
                        (setuid (passwd:uid user))
                        (execl pg_ctl pg_ctl "-D" #$data-directory "-o" options
+                              "--log=/var/log/postgresql/pg_ctl"
                               mode)))))))
             (pid-file (in-vicinity data-directory "postmaster.pid"))
             (action (lambda args
-- 
2.29.2





             reply	other threads:[~2021-01-01 10:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-01 10:10 Christopher Baines [this message]
2021-01-06  9:22 ` [bug#45588] [PATCH] services: postgresql: Log from pg_ctl Mathieu Othacehe
2021-01-14 13:51   ` Mathieu Othacehe
2021-02-22 22:30 ` bug#45588: " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210101101015.6524-1-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=45588@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.