services: prosody: Get the Shepherd to respawn Prosody.

* gnu/services/messaging.scm (prosody-shepherd-service): Return the PID when
the action is "start".
This commit is contained in:
Clément Lassieur 2018-08-13 17:35:24 +02:00
parent 2ded865665
commit fdbca05d78
No known key found for this signature in database
GPG key ID: 89F96D4808F359C7

View file

@ -632,13 +632,20 @@ (define (prosody-shepherd-service config)
(opaque-prosody-configuration-prosody config) (opaque-prosody-configuration-prosody config)
(prosody-configuration-prosody config))) (prosody-configuration-prosody config)))
(prosodyctl-bin (file-append prosody "/bin/prosodyctl")) (prosodyctl-bin (file-append prosody "/bin/prosodyctl"))
(pid-file (prosody-configuration-pidfile config))
(prosodyctl-action (lambda args (prosodyctl-action (lambda args
#~(lambda _ #~(lambda _
(invoke #$prosodyctl-bin #$@args))))) (invoke #$prosodyctl-bin #$@args)
(match '#$args
(("start")
(call-with-input-file #$pid-file read))
(_ #t))))))
(list (shepherd-service (list (shepherd-service
(documentation "Run the Prosody XMPP server") (documentation "Run the Prosody XMPP server")
(provision '(prosody xmpp-daemon)) (provision '(prosody xmpp-daemon))
(requirement '(networking syslogd user-processes)) (requirement '(networking syslogd user-processes))
(modules `((ice-9 match)
,@%default-modules))
(start (prosodyctl-action "start")) (start (prosodyctl-action "start"))
(stop (prosodyctl-action "stop")))))) (stop (prosodyctl-action "stop"))))))