if no containers, don't show service status of podman containers.

This commit is contained in:
Joseph Hanson 2024-05-30 23:28:07 -05:00
parent d820259c32
commit 8c70906d0f

View file

@ -53,22 +53,24 @@ let
zpool list -Ho name,cap,size | awk '{ printf("%-10s%+3s used out of %+5s\n", $1, $2, $3); }' | sed -e 's/^/ /' zpool list -Ho name,cap,size | awk '{ printf("%-10s%+3s used out of %+5s\n", $1, $2, $3); }' | sed -e 's/^/ /'
fi fi
printf "\n" printf "\n"
printf "$BOLDService status$ENDCOLOR\n"
while IFS= read -r line; do if [[ -n "$service_status" ]]; then
if [[ $line =~ ".scope" ]]; then printf "$BOLDService status$ENDCOLOR\n"
continue while IFS= read -r line; do
fi if [[ $line =~ ".scope" ]]; then
if echo "$line" | grep -q 'failed'; then continue
service_name=$(echo $line | awk '{print $2;}' | sed 's/podman-//g') fi
printf "$RED $ENDCOLOR%-50s $RED[failed]$ENDCOLOR\n" "$service_name" if echo "$line" | grep -q 'failed'; then
elif echo "$line" | grep -q 'running'; then service_name=$(echo $line | awk '{print $2;}' | sed 's/podman-//g')
service_name=$(echo $line | awk '{print $1;}' | sed 's/podman-//g') printf "$RED $ENDCOLOR%-50s $RED[failed]$ENDCOLOR\n" "$service_name"
printf "$GREEN $ENDCOLOR%-50s $GREEN[active]$ENDCOLOR\n" "$service_name" elif echo "$line" | grep -q 'running'; then
else service_name=$(echo $line | awk '{print $1;}' | sed 's/podman-//g')
echo "service status unknown" printf "$GREEN $ENDCOLOR%-50s $GREEN[active]$ENDCOLOR\n" "$service_name"
fi else
done <<< "$service_status" echo "service status unknown"
fi
done <<< "$service_status"
fi
''; '';
cfg = config.mySystem.system.motd; cfg = config.mySystem.system.motd;
in in