* [herd] Have status display services as a bulleted list.
@ 2016-11-23 21:03 Christopher Allan Webber
2016-11-24 8:28 ` Hartmut Goebel
2016-11-24 16:16 ` Ludovic Courtès
0 siblings, 2 replies; 6+ messages in thread
From: Christopher Allan Webber @ 2016-11-23 21:03 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 2716 bytes --]
I don't know about you, but I am totally unable to read the
"herd status" line as it exists in the current state. I mean, I love
sexps, but even I don't like a completely flat and ungreppable list
printed to stdout.
*** Previous output ***
cwebber@oolong:~/devel/shepherd$ sudo herd -s /var/run/shepherd/socket status
Started: (file-system-/run/systemd xorg-server file-system-/sys/fs/cgroup/cpuacct file-system-/mnt/debian syslogd term-tty1 root-file-system file-system-/sys/fs/cgroup/blkio avahi-daemon file-system-/sys/fs/cgroup upower-daemon console-font-tty6 console-font-tty3 nscd file-system-/run/user file-system-/sys/fs/cgroup/memory file-system-/dev/pts loopback term-tty2 user-processes term-tty4 postgres file-system-/sys/fs/cgroup/perf_event file-system-/sys/fs/cgroup/cpuset device-mapping-home-luks guix-daemon file-system-/sys/fs/cgroup/elogind file-system-/sys/fs/cgroup/devices file-system-/dev/shm dbus-system console-font-tty5 term-tty6 host-name term-tty3 file-system-/sys/fs/cgroup/hugetlb file-system-/sys/fs/cgroup/cpu file-system-/home networking ntpd console-font-tty4 urandom-seed user-file-
systems file-system-/sys/fs/cgroup/freezer file-system-/gnu/store root console-font-tty2 term-tty5 console-font-tty1 udev)
Stopped: (ssh-daemon)
*** New output ***
cwebber@oolong:~/devel/shepherd$ sudo ./herd -s /var/run/shepherd/socket status
Started:
+ file-system-/run/systemd
+ xorg-server
+ file-system-/sys/fs/cgroup/cpuacct
+ file-system-/mnt/debian
+ syslogd
+ term-tty1
+ root-file-system
+ file-system-/sys/fs/cgroup/blkio
+ avahi-daemon
+ file-system-/sys/fs/cgroup
+ upower-daemon
+ console-font-tty6
+ console-font-tty3
+ nscd
+ file-system-/run/user
+ file-system-/sys/fs/cgroup/memory
+ file-system-/dev/pts
+ loopback
+ term-tty2
+ user-processes
+ term-tty4
+ postgres
+ file-system-/sys/fs/cgroup/perf_event
+ file-system-/sys/fs/cgroup/cpuset
+ device-mapping-home-luks
+ guix-daemon
+ file-system-/sys/fs/cgroup/elogind
+ file-system-/sys/fs/cgroup/devices
+ file-system-/dev/shm
+ dbus-system
+ console-font-tty5
+ term-tty6
+ host-name
+ term-tty3
+ file-system-/sys/fs/cgroup/hugetlb
+ file-system-/sys/fs/cgroup/cpu
+ file-system-/home
+ networking
+ ntpd
+ console-font-tty4
+ urandom-seed
+ user-file-systems
+ file-system-/sys/fs/cgroup/freezer
+ file-system-/gnu/store
+ root
+ console-font-tty2
+ term-tty5
+ console-font-tty1
+ udev
Stopped:
- ssh-daemon
Whew! I can read that finally. And grep it too!
Speaking of grepping, the new bulleted behavior uses a "+" for services
enabled, and a "-" for disabled services. That way if you do a grep,
you'll still know whether it was enabled/disabled.
- Chris
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-herd-Have-status-display-services-as-a-bulleted-list.patch --]
[-- Type: text/x-patch, Size: 1685 bytes --]
From d9391382286b1dc5a0719c9e1e6ac1e5941bbb87 Mon Sep 17 00:00:00 2001
From: Christopher Allan Webber <cwebber@dustycloud.org>
Date: Wed, 23 Nov 2016 14:53:18 -0600
Subject: [PATCH] herd: Have status display services as a bulleted list.
* modules/shepherd/scripts/herd.scm (display-status-summary): Display
services as an ascii bulleted list.
---
modules/shepherd/scripts/herd.scm | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/modules/shepherd/scripts/herd.scm b/modules/shepherd/scripts/herd.scm
index 0ad52b2..06256c1 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -46,6 +46,11 @@ of pairs."
(define (display-status-summary services)
"Display a summary of the status of all of SERVICES."
+ (define (display-services header bullet services)
+ (display header)
+ (for-each (lambda (service)
+ (format #t " ~a ~a~%" bullet (service-canonical-name service)))
+ services))
(call-with-values
(lambda ()
(partition (match-lambda
@@ -53,10 +58,10 @@ of pairs."
(car (assoc-ref properties 'running))))
services))
(lambda (started stopped)
- (format #t (l10n "Started: ~a~%")
- (map service-canonical-name started))
- (format #t (l10n "Stopped: ~a~%")
- (map service-canonical-name stopped)))))
+ (display-services (l10n "Started:\n") "+"
+ started)
+ (display-services (l10n "Stopped:\n") "-"
+ stopped))))
(define (display-detailed-status services)
"Display the detailed status of SERVICES."
--
2.10.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [herd] Have status display services as a bulleted list.
2016-11-23 21:03 [herd] Have status display services as a bulleted list Christopher Allan Webber
@ 2016-11-24 8:28 ` Hartmut Goebel
2016-11-24 9:00 ` Alex Sassmannshausen
2016-11-24 16:16 ` Ludovic Courtès
1 sibling, 1 reply; 6+ messages in thread
From: Hartmut Goebel @ 2016-11-24 8:28 UTC (permalink / raw)
To: guix-devel
Am 23.11.2016 um 22:03 schrieb Christopher Allan Webber:
> Whew! I can read that finally. And grep it too!
+1
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel@crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [herd] Have status display services as a bulleted list.
2016-11-23 21:03 [herd] Have status display services as a bulleted list Christopher Allan Webber
2016-11-24 8:28 ` Hartmut Goebel
@ 2016-11-24 16:16 ` Ludovic Courtès
2016-11-25 4:55 ` Christopher Allan Webber
1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2016-11-24 16:16 UTC (permalink / raw)
To: Christopher Allan Webber; +Cc: guix-devel
Christopher Allan Webber <cwebber@dustycloud.org> skribis:
> I don't know about you, but I am totally unable to read the
> "herd status" line as it exists in the current state. I mean, I love
> sexps, but even I don't like a completely flat and ungreppable list
> printed to stdout.
Agreed!
> *** New output ***
>
> cwebber@oolong:~/devel/shepherd$ sudo ./herd -s /var/run/shepherd/socket status
> Started:
> + file-system-/run/systemd
> + xorg-server
> + file-system-/sys/fs/cgroup/cpuacct
> + file-system-/mnt/debian
> + syslogd
> + term-tty1
> + root-file-system
> + file-system-/sys/fs/cgroup/blkio
> + avahi-daemon
Works for me! I’m just wondering if there are ideas we could/should
follow more closely the output of ‘systemctl status’. IIRC, it displays
a couple of lines for each service; for instance, we could display the
“running” value and dependencies of each service, indented below its
name.
WDYT? Would that make sense?
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [herd] Have status display services as a bulleted list.
2016-11-24 16:16 ` Ludovic Courtès
@ 2016-11-25 4:55 ` Christopher Allan Webber
2016-11-25 23:08 ` Ludovic Courtès
0 siblings, 1 reply; 6+ messages in thread
From: Christopher Allan Webber @ 2016-11-25 4:55 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ludovic Courtès writes:
> Christopher Allan Webber <cwebber@dustycloud.org> skribis:
>
>> I don't know about you, but I am totally unable to read the
>> "herd status" line as it exists in the current state. I mean, I love
>> sexps, but even I don't like a completely flat and ungreppable list
>> printed to stdout.
>
> Agreed!
>
>> *** New output ***
>>
>> cwebber@oolong:~/devel/shepherd$ sudo ./herd -s /var/run/shepherd/socket status
>> Started:
>> + file-system-/run/systemd
>> + xorg-server
>> + file-system-/sys/fs/cgroup/cpuacct
>> + file-system-/mnt/debian
>> + syslogd
>> + term-tty1
>> + root-file-system
>> + file-system-/sys/fs/cgroup/blkio
>> + avahi-daemon
>
> Works for me! I’m just wondering if there are ideas we could/should
> follow more closely the output of ‘systemctl status’. IIRC, it displays
> a couple of lines for each service; for instance, we could display the
> “running” value and dependencies of each service, indented below its
> name.
>
> WDYT? Would that make sense?
>
> Ludo’.
It's a good idea, and I think we should shoot for better output.
Listing a tree of dependencies is a great idea.
But I'm unlikely to have time to get to it soon. I think it should be
on our TODO list, but for now, the preceding patch will still be a nice
improvement.
If someone else wants to step up to make those changes, of course,
great!
- Chris
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [herd] Have status display services as a bulleted list.
2016-11-25 4:55 ` Christopher Allan Webber
@ 2016-11-25 23:08 ` Ludovic Courtès
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2016-11-25 23:08 UTC (permalink / raw)
To: Christopher Allan Webber; +Cc: guix-devel
Christopher Allan Webber <cwebber@dustycloud.org> skribis:
> Ludovic Courtès writes:
>
>> Christopher Allan Webber <cwebber@dustycloud.org> skribis:
>>
>>> I don't know about you, but I am totally unable to read the
>>> "herd status" line as it exists in the current state. I mean, I love
>>> sexps, but even I don't like a completely flat and ungreppable list
>>> printed to stdout.
>>
>> Agreed!
>>
>>> *** New output ***
>>>
>>> cwebber@oolong:~/devel/shepherd$ sudo ./herd -s /var/run/shepherd/socket status
>>> Started:
>>> + file-system-/run/systemd
>>> + xorg-server
>>> + file-system-/sys/fs/cgroup/cpuacct
>>> + file-system-/mnt/debian
>>> + syslogd
>>> + term-tty1
>>> + root-file-system
>>> + file-system-/sys/fs/cgroup/blkio
>>> + avahi-daemon
>>
>> Works for me! I’m just wondering if there are ideas we could/should
>> follow more closely the output of ‘systemctl status’. IIRC, it displays
>> a couple of lines for each service; for instance, we could display the
>> “running” value and dependencies of each service, indented below its
>> name.
>>
>> WDYT? Would that make sense?
>>
>> Ludo’.
>
> It's a good idea, and I think we should shoot for better output.
> Listing a tree of dependencies is a great idea.
>
> But I'm unlikely to have time to get to it soon. I think it should be
> on our TODO list, but for now, the preceding patch will still be a nice
> improvement.
You’re right. Applied with an adjusted test.
Thank you!
Ludo’.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-25 23:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-23 21:03 [herd] Have status display services as a bulleted list Christopher Allan Webber
2016-11-24 8:28 ` Hartmut Goebel
2016-11-24 9:00 ` Alex Sassmannshausen
2016-11-24 16:16 ` Ludovic Courtès
2016-11-25 4:55 ` Christopher Allan Webber
2016-11-25 23:08 ` Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.