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
|
||||
|
||||
out=""
|
||||
for i in ${!services[@]}; do
|
||||
for i in "${!services[@]}"; do
|
||||
# color green if service is active, else red
|
||||
if [[ "${service_status[$i]}" == "active" ]]; then
|
||||
out+="${services[$i]}:,${green}${service_status[$i]}${undim},"
|
||||
@ -55,8 +55,8 @@ printf "$out" | column -ts $',' | sed -e 's/^/ /'
|
||||
|
||||
|
||||
### Docker ###
|
||||
containers=($(docker ps -a --format "{{.Image}} / {{.Names}}"))
|
||||
container_statuses=($(docker ps -a --format "{{.State}}"))
|
||||
containers=($(docker ps --format "{{.Image}}/{{.Names}}"))
|
||||
container_statuses=($(docker ps --format "{{.State}}"))
|
||||
out=""
|
||||
for i in ${!containers[@]}; do
|
||||
if [[ "${container_statuses[$i]}" == "running" ]]; then
|
||||
@ -64,7 +64,7 @@ for i in ${!containers[@]}; do
|
||||
else
|
||||
out+="${containers[$i]}:,${red}${container_statuses[$i]}${undim},"
|
||||
fi
|
||||
out += "\n"
|
||||
out+="\n"
|
||||
done
|
||||
printf "\nDocker:\n"
|
||||
printf "$out" | column -ts $',' | sed -e 's/^/ /'
|
||||
|
Loading…
Reference in New Issue
Block a user