motd.sh: fix docker display

This commit is contained in:
Alice Gaudon 2022-06-23 12:00:07 +02:00
parent d6a1b3ef6a
commit e7769419b1

View File

@ -36,7 +36,7 @@ for service in "${services[@]}"; do
done done
out="" out=""
for i in ${!services[@]}; do for i in "${!services[@]}"; do
# color green if service is active, else red # color green if service is active, else red
if [[ "${service_status[$i]}" == "active" ]]; then if [[ "${service_status[$i]}" == "active" ]]; then
out+="${services[$i]}:,${green}${service_status[$i]}${undim}," out+="${services[$i]}:,${green}${service_status[$i]}${undim},"
@ -55,8 +55,8 @@ printf "$out" | column -ts $',' | sed -e 's/^/ /'
### Docker ### ### Docker ###
containers=($(docker ps -a --format "{{.Image}} / {{.Names}}")) containers=($(docker ps --format "{{.Image}}/{{.Names}}"))
container_statuses=($(docker ps -a --format "{{.State}}")) container_statuses=($(docker ps --format "{{.State}}"))
out="" out=""
for i in ${!containers[@]}; do for i in ${!containers[@]}; do
if [[ "${container_statuses[$i]}" == "running" ]]; then if [[ "${container_statuses[$i]}" == "running" ]]; then