guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 08/08: herd: Display information about systemd services.


From: Ludovic Courtès
Subject: [shepherd] 08/08: herd: Display information about systemd services.
Date: Sat, 17 Feb 2024 13:07:19 -0500 (EST)

civodul pushed a commit to branch devel
in repository shepherd.

commit 5c87fef615c1e40ae869836e6bac32da781af7f9
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Feb 17 19:03:29 2024 +0100

    herd: Display information about systemd services.
    
    * modules/shepherd/scripts/herd.scm (display-service-status): Add clause
    for (systemd-service …) sexps.
    * tests/systemd.sh: Test it.
---
 modules/shepherd/scripts/herd.scm | 15 +++++++++++++++
 tests/systemd.sh                  |  5 ++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/shepherd/scripts/herd.scm 
b/modules/shepherd/scripts/herd.scm
index 759c73e..3d22d31 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -295,6 +295,21 @@ relevant bits quoted according to POSIX shell rules."
                     (format #t "    - ~a~%"
                             (socket-address->string address)))
                   addresses))
+       (('systemd-service ('version 0)
+                          ('endpoints (('endpoint ('version 0)
+                                                  ('name names)
+                                                  ('address addresses)
+                                                  _ ...) ...))
+                          _ ...)
+        ;; TRANSLATORS: "Systemd" should be kept untranslated.
+        (format #t (l10n "  Systemd-style service listening on ~a endpoint:~%"
+                         "  Systemd-style service listening on ~a endpoints:~%"
+                         (length names))
+                (length names))
+        (for-each (lambda (name address)
+                    (format #t "    - ~a (~s)~%"
+                            (socket-address->string address) name))
+                  names addresses))
        (_
         ;; TRANSLATORS: The "~s" bit is most of the time a placeholder for a
         ;; Scheme value associated with the service.
diff --git a/tests/systemd.sh b/tests/systemd.sh
index 19617e6..b2d5a54 100644
--- a/tests/systemd.sh
+++ b/tests/systemd.sh
@@ -1,5 +1,5 @@
 # GNU Shepherd --- Test transient services.
-# Copyright © 2022-2023 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2022-2024 Ludovic Courtès <ludo@gnu.org>
 #
 # This file is part of the GNU Shepherd.
 #
@@ -109,6 +109,9 @@ $herd start test-systemd-unix
 $herd status test-systemd-unix | grep running
 test $($herd status | grep '\+' | wc -l) -eq 2
 
+$herd status test-systemd-unix | grep "Systemd-style"
+$herd status test-systemd-unix | grep "$service_socket"
+
 test "$(file_permissions "$service_socket_dir")" = "700"
 test "$(file_permissions "$service_socket")" = "666"
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]