commit b315e2256586bec9284e73a47747f6771972b1ef
parent f6399a9179f178ee0cdd3bf473308300e8c86d2a
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date: Fri, 29 Jul 2022 02:45:07 +0200
Indicate whether service should be brought up or down.
Diffstat:
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/command/s b/command/s
@@ -39,6 +39,7 @@ load_s6_rc() {
done
process_bundles
+ process_default
}
process_bundles() {
@@ -66,12 +67,14 @@ process_bundles() {
load_svstat() {
typeset -gA service_stat
+ typeset -ga s6_services
local -a svstat
local s svcdir
for svcdir in /run/service/*(-/); do
s=$svcdir:t
+ s6_services+=( $s )
if svstat=( $(s6-svstat $svcdir) ); then
service_stat[$s]=$svstat[1]
[[ $service_stat[$s] == up && $svstat[3] == ? ]] && service_stat[$s]=starting
@@ -100,9 +103,13 @@ show_oneshots() {
for s in $oneshots; do
pre=''
if (($+service_active[$s] ^^ $+service_in_bundle[$s//$default_bundle])); then
- pre='%S'
+ if (($+service_active[$s])); then
+ pre='_%S'
+ else
+ pre='^%S'
+ fi
fi
- printf "%s %s" ${(%)fmt_active[${service_active[$s]:-2}]} ${(%)pre}$s${(%)post}
+ printf "%s %s" ${(%)fmt_active[${service_active[$s]:-2}]} ${(%)pre}$s${(%)post}
print_service_bundles $s
done
}
@@ -119,7 +126,11 @@ show_longruns() {
fi
pre=''
if (($+service_active[$s] ^^ $+service_in_bundle[$s//$default_bundle])); then
- pre='%S'
+ if (($+service_active[$s])); then
+ pre='_%S'
+ else
+ pre='^%S'
+ fi
fi
printf "%s %s" ${(%)fmt_up[$state]}${(%)fmt_active[$active]} ${(%)pre}$s${(%)post}
print_service_bundles $s