Skip to content
Snippets Groups Projects

Docker checks: remove emoji icons; handle "null" in license info; show rootless or not

1 file
+ 9
5
Compare changes
  • Side-by-side
  • Inline
+ 9
5
@@ -14,6 +14,7 @@
# 2024-01-18 v1.0 <axel.hahn@unibe.ch> init
# 2024-01-22 v1.1 <axel.hahn@unibe.ch> detect DOCKER; use sudo; add debug
# 2024-01-23 v1.2 <axel.hahn@unibe.ch> Show a list of docker containers; add path
# 2024-01-24 v1.3 <axel.hahn@unibe.ch> remove emoji icons; handle "null" in license info
# ======================================================================
@@ -117,6 +118,8 @@ iImages=$( _getString "$data" ".Images" )
sVersion=$( _getString "$data" ".ServerVersion")
sLicense=$( _getString "$data" ".ProductLicense" )
test "$sLicense" = "null" && sLicense="no license info"
# --- generate result
if [ "$iCTotal" -eq "0" ]; then
@@ -159,13 +162,14 @@ if [ $bOptContainers -eq 1 ] && [ "$iCTotal" -gt "0" ]; then
sName=$( _getString "$line" ".Names" )
sState=$( _getString "$line" ".State" )
sStatus=$( _getString "$line" ".Status" )
sIco="🔶"
grep "exited" <<< "${sState}" >/dev/null && sIco="❌"
grep "running" <<< "${sState}" >/dev/null && sIco="✅"
sIco=
# Icinga ui does not show these characters
# sIco="🔶"
# grep "exited" <<< "${sState}" >/dev/null && sIco="❌"
# grep "running" <<< "${sState}" >/dev/null && sIco="✅"
printf " %-14s %-40s %-20s\n" "$sIco $sState" "$sName" "$sStatus"
# echo "$line" | jq
done
echo
Loading