guix-commits
[Top][All Lists]
Advanced

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

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


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

civodul pushed a commit to branch devel
in repository shepherd.

commit 6c97a4f358a29bf3530039b0f78e4ee780d10102
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Feb 17 18:51:04 2024 +0100

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

diff --git a/modules/shepherd/scripts/herd.scm 
b/modules/shepherd/scripts/herd.scm
index 1e3b8cc..759c73e 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -279,6 +279,22 @@ relevant bits quoted according to POSIX shell rules."
         (format #t (l10n "  PID ~a running: ~a~%")
                 (highlight (number->string pid))
                 (shell-quoted-command command)))
+       (('inetd-service ('version 0)
+                        ('endpoints (('endpoint ('version 0)
+                                                ('name names)
+                                                ('address addresses)
+                                                _ ...) ...))
+                        _ ...)
+        ;; TRANSLATORS: "Inetd" refers to a type of service and should be kept
+        ;; as-is.
+        (format #t (l10n "  Inetd-style service listening on ~a endpoint:~%"
+                         "  Inetd-style service listening on ~a endpoints:~%"
+                         (length names))
+                (length names))
+        (for-each (lambda (address)
+                    (format #t "    - ~a~%"
+                            (socket-address->string address)))
+                  addresses))
        (_
         ;; TRANSLATORS: The "~s" bit is most of the time a placeholder for a
         ;; Scheme value associated with the service.
diff --git a/tests/inetd.sh b/tests/inetd.sh
index 00f89e6..2d63d67 100644
--- a/tests/inetd.sh
+++ b/tests/inetd.sh
@@ -120,6 +120,9 @@ converse_with_echo_server ()
       (match (read-line sock) (\"done\" #t))"
 }
 
+$herd status test-inetd | grep "Inetd-style service"
+$herd status test-inetd | grep "127\.0\.0\.1:$PORT"
+
 # Initiate a conversation and make sure it creates a transient service with
 # correct process information.
 guile -c "



reply via email to

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