|
From: | Ludovic Courtès |
Subject: | bug#29992: [PATCH] services: postgresql: Use pg_ctl to start and stop postgres. |
Date: | Wed, 24 Jan 2018 16:04:14 +0100 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Clément Lassieur <address@hidden> skribis: > Fixes <https://bugs.gnu.org/29992>. > > * gnu/services/databases.scm (postgresql-shepherd-service): Replace > make-forkexec-constructor and make-kill-destructor with pg_ctl. [...] > + (let* ((pg_ctl-wrapper > + ;; Wrapper script that switches to the 'postgres' user before > + ;; launching daemon. > + (program-file > + "pg_ctl-wrapper" > + #~(begin > + (use-modules (ice-9 match) > + (ice-9 format)) > + (match (command-line) > + ((_ mode) > + (let ((user (getpwnam "postgres")) > + (pg_ctl #$(file-append postgresql "/bin/pg_ctl"))) > + (setgid (passwd:gid user)) > + (setuid (passwd:uid user)) > + (system > + (format #f "~a -D ~a -o '--config-file=~a -p ~d' ~a" > + pg_ctl #$data-directory #$config-file #$port > + mode)))))))) I think we should use ‘execl’ here instead of ‘system’ so that (1) the exit code is correct, and (2) we don’t go through /bin/sh. Apart from that it LGTM, thank you! Ludo’.
[Prev in Thread] | Current Thread | [Next in Thread] |