services: prosody: Get the Shepherd to respawn Prosody.
authorClément Lassieur <clement@lassieur.org>
Mon, 13 Aug 2018 15:35:24 +0000 (17:35 +0200)
committerClément Lassieur <clement@lassieur.org>
Mon, 13 Aug 2018 16:11:02 +0000 (18:11 +0200)
* gnu/services/messaging.scm (prosody-shepherd-service): Return the PID when
the action is "start".

gnu/services/messaging.scm

index 6d3a580..1108006 100644 (file)
@@ -632,13 +632,20 @@ See also @url{https://prosody.im/doc/modules/mod_muc}."
                       (opaque-prosody-configuration-prosody config)
                       (prosody-configuration-prosody config)))
          (prosodyctl-bin (file-append prosody "/bin/prosodyctl"))
+         (pid-file (prosody-configuration-pidfile config))
          (prosodyctl-action (lambda args
                               #~(lambda _
-                                  (invoke #$prosodyctl-bin #$@args)))))
+                                  (invoke #$prosodyctl-bin #$@args)
+                                  (match '#$args
+                                    (("start")
+                                     (call-with-input-file #$pid-file read))
+                                    (_ #t))))))
     (list (shepherd-service
            (documentation "Run the Prosody XMPP server")
            (provision '(prosody xmpp-daemon))
            (requirement '(networking syslogd user-processes))
+           (modules `((ice-9 match)
+                      ,@%default-modules))
            (start (prosodyctl-action "start"))
            (stop (prosodyctl-action "stop"))))))