Created
September 12, 2018 07:30
-
-
Save pvalena/3ac18c3bc7ef6d0eeaffedb7e0b7e287 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# ./getocstatus.sh [interval] | |
# | |
i="${1:-10}" | |
main () { | |
{ | |
oc get | |
echo " * templates" | |
} 2>&1 | grep '^ *' | tr -s '\t' ' ' | cut -d' ' -f3 | sort -u \ | |
| grep -vE '^(all|podpreset|serviceaccounts|rolebindings|clusterroles|events|persistentvolumes|imagestreamtags|projects|secrets|userserror\:)$' \ | |
| while read n; do | |
d="$( | |
{ oc get "$n" ; } 2>&1 \ | |
| grep -v '^No resources found.$' \ | |
| grep -v '^Error from server (Forbidden): ' \ | |
| grep -v '^Error from server (NotFound): ' \ | |
| grep -v "^error: the server doesn't have a resource type " \ | |
| grep -v "^The connection to the server " \ | |
)" | |
[[ -z "$d" ]] && continue | |
echo -e "\n >>> $n\n$d" | |
done | |
} | |
P= | |
while X="`main`"; do | |
[[ "$P" == "$X" ]] && continue | |
clear | |
echo "$X" | |
P="$X" | |
sleep $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment