Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Copy this script to your bin directory and connect faster to your
- # pods running the this script:
- #
- # $ ocrsh <aprtial pod name>
- #
- # Example:
- # Avalilable pods: consumer, workbench, rabbitmq, memcached
- #
- # $ ocrsh cons
- # $ ocrsh wo
- # $ ocrsh rab
- # $ ocrsh mem
- #
- printUsage()
- {
- echo ""
- echo " Usage: $0 <pod name>"
- echo ""
- }
- printAvailablePods()
- {
- oc get pods | awk 'NR != 1 {print $1}' | awk '{print substr($0, 1, length($0)-6)}'
- }
- if [ -z "$1" ]
- then
- printUsage
- exit
- fi
- POD=`oc get pods | grep $1 | awk 'NR==1{print $1}'`
- if [ $POD ]
- then
- oc rsh $POD
- else
- echo "No pods available for '$1'"
- echo
- printAvailablePods
- echo
- exit 1
- fi
Add Comment
Please, Sign In to add comment