#!/bin/zsh setopt extended_glob no_unset zmodload -F zsh/stat b:zstat for sv in /run/service/* /run/user/$UID/service/*; do svstat=- [[ -r $sv/supervise/lock ]] && svstat=$(s6-svstat $sv) printf '%s\t%s\n' $sv $svstat if [[ $sv == /run/service/container.* && -r /run/containers/${sv##*/container.}/run/service/.s6-svscan/lock ]]; then for sv2 in /run/containers/${sv##*/container.}/run/service/*(N); do sv_name=${sv2:t} svstat=- if zstat -L -A lnk +link $sv2 && [[ $lnk[1] == /run/* ]]; then sv2=${sv2:h:h:h}${lnk[1]} fi [[ -r $sv2/supervise/lock ]] && svstat=$(s6-svstat $sv2) printf '\t%s\t%s\n' $sv_name $svstat done fi done