guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 04/06: herd: ‘herd status’ lists timers separately.


From: Ludovic Courtès
Subject: [shepherd] 04/06: herd: ‘herd status’ lists timers separately.
Date: Sun, 24 Mar 2024 17:11:35 -0400 (EDT)

civodul pushed a commit to branch devel
in repository shepherd.

commit 3b098074cd6efe10e3aa6bc08d9d1161cd501181
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Mar 24 15:53:32 2024 +0100

    herd: ‘herd status’ lists timers separately.
    
    * modules/shepherd/scripts/herd.scm (live-service-timer?): New
    procedure.
    (display-status-summary): Display timers separately from other started
    services.
---
 modules/shepherd/scripts/herd.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/shepherd/scripts/herd.scm 
b/modules/shepherd/scripts/herd.scm
index 78917af..7c13568 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -69,6 +69,12 @@
   "Return the 'canonical name' of @var{service}."
   (first (live-service-provision service)))
 
+(define (live-service-timer? service)
+  "Return true if @var{service}'s value is a timer."
+  (match (live-service-running-value service)
+    (('timer . _) #t)
+    (_ #f)))
+
 (define (live-service-failing? service)
   "Return true if @var{service} failed to start."
   (and (eq? 'stopped (live-service-status service))
@@ -158,10 +164,13 @@ transient status for too long."
          (stopped  (filter (live-service-status-predicate 'stopped) services))
          (starting (filter (live-service-status-predicate 'starting) services))
          (stopping (filter (live-service-status-predicate 'stopping) services))
+         (timers started   (partition live-service-timer? started))
          (one-shot stopped (partition live-service-one-shot? stopped))
          (failing stopped  (partition live-service-failing? stopped)))
     (display-services (highlight (l10n "Started:\n")) "+"
                       started)
+    (display-services (highlight (l10n "Running timers:\n")) "+"
+                      timers)
     (display-services (highlight (l10n "Starting:\n")) "^"
                       starting)
 



reply via email to

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