summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/guix.texi10
-rw-r--r--gnu/services/audio.scm11
2 files changed, 21 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index b5eca57d75..ea1e391a6f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -34251,6 +34251,16 @@ The following example shows how one might run @code{mpd} as user
           (port "6666")))
 @end lisp
 
+Most MPD clients will trigger a database update upon connecting, but you
+can also use the @code{update} action do to so:
+
+@example
+herd update mpd
+@end example
+
+All the MPD configuration fields are documented below, and a more
+complex example follows.
+
 @defvar mpd-service-type
 The service type for @command{mpd}
 @end defvar
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
index 8c061da47f..6e4ce3f9fb 100644
--- a/gnu/services/audio.scm
+++ b/gnu/services/audio.scm
@@ -620,6 +620,17 @@ appended to the configuration.")
                           (format #t
                                   "Issued SIGHUP to Service MPD (PID ~a)."
                                   pid))
+                        (format #t "Service MPD is not running.")))))
+              (shepherd-action
+               (name 'update)
+               (documentation "Request MPD to update its music database.")
+               (procedure
+                #~(lambda (pid)
+                    (if pid
+                        (begin
+                          (invoke #$(file-append mpd-mpc "/bin/mpc") "update")
+                          (format #t "Database update requested for service \
+MPD (PID ~a)." pid))
                         (format #t "Service MPD is not running.")))))))))))
 
 (define (mpd-accounts config)