mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-19 05:57:04 +01:00
services: postgresql: Get the Shepherd to respawn PostgreSQL.
* gnu/services/databases.scm (postgresql-shepherd-service): Change 'start' to return the PID.
This commit is contained in:
parent
ff6436307e
commit
ef2dda8edb
1 changed files with 8 additions and 1 deletions
|
@ -221,13 +221,20 @@ (define postgresql-shepherd-service
|
||||||
(setuid (passwd:uid user))
|
(setuid (passwd:uid user))
|
||||||
(execl pg_ctl pg_ctl "-D" #$data-directory "-o" options
|
(execl pg_ctl pg_ctl "-D" #$data-directory "-o" options
|
||||||
mode)))))))
|
mode)))))))
|
||||||
|
(pid-file (in-vicinity data-directory "postmaster.pid"))
|
||||||
(action (lambda args
|
(action (lambda args
|
||||||
#~(lambda _
|
#~(lambda _
|
||||||
(invoke #$pg_ctl-wrapper #$@args)))))
|
(invoke #$pg_ctl-wrapper #$@args)
|
||||||
|
(match '#$args
|
||||||
|
(("start")
|
||||||
|
(call-with-input-file #$pid-file read))
|
||||||
|
(_ #t))))))
|
||||||
(list (shepherd-service
|
(list (shepherd-service
|
||||||
(provision '(postgres))
|
(provision '(postgres))
|
||||||
(documentation "Run the PostgreSQL daemon.")
|
(documentation "Run the PostgreSQL daemon.")
|
||||||
(requirement '(user-processes loopback syslogd))
|
(requirement '(user-processes loopback syslogd))
|
||||||
|
(modules `((ice-9 match)
|
||||||
|
,@%default-modules))
|
||||||
(start (action "start"))
|
(start (action "start"))
|
||||||
(stop (action "stop"))))))))
|
(stop (action "stop"))))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue