motd.sh: fix docker display
This commit is contained in:
parent
d6a1b3ef6a
commit
e7769419b1
8
motd.sh
8
motd.sh
@ -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
|
||||||
@ -64,7 +64,7 @@ for i in ${!containers[@]}; do
|
|||||||
else
|
else
|
||||||
out+="${containers[$i]}:,${red}${container_statuses[$i]}${undim},"
|
out+="${containers[$i]}:,${red}${container_statuses[$i]}${undim},"
|
||||||
fi
|
fi
|
||||||
out += "\n"
|
out+="\n"
|
||||||
done
|
done
|
||||||
printf "\nDocker:\n"
|
printf "\nDocker:\n"
|
||||||
printf "$out" | column -ts $',' | sed -e 's/^/ /'
|
printf "$out" | column -ts $',' | sed -e 's/^/ /'
|
||||||
|
Loading…
Reference in New Issue
Block a user