Add docker to motd.sh
This commit is contained in:
parent
695dd52dc8
commit
d6a1b3ef6a
16
motd.sh
16
motd.sh
@ -54,6 +54,22 @@ printf "\nServices:\n"
|
||||
printf "$out" | column -ts $',' | sed -e 's/^/ /'
|
||||
|
||||
|
||||
### Docker ###
|
||||
containers=($(docker ps -a --format "{{.Image}} / {{.Names}}"))
|
||||
container_statuses=($(docker ps -a --format "{{.State}}"))
|
||||
out=""
|
||||
for i in ${!containers[@]}; do
|
||||
if [[ "${container_statuses[$i]}" == "running" ]]; then
|
||||
out+="${containers[$i]}:,${green}${container_statuses[$i]}${undim},"
|
||||
else
|
||||
out+="${containers[$i]}:,${red}${container_statuses[$i]}${undim},"
|
||||
fi
|
||||
out += "\n"
|
||||
done
|
||||
printf "\nDocker:\n"
|
||||
printf "$out" | column -ts $',' | sed -e 's/^/ /'
|
||||
|
||||
|
||||
### Disk space ###
|
||||
# config
|
||||
max_usage=80
|
||||
|
Loading…
Reference in New Issue
Block a user