Last active
August 24, 2017 10:46
-
-
Save paulja/f05313e9a50b09dae064a42a07b196e0 to your computer and use it in GitHub Desktop.
Cloud Foundry App Monitor
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 | |
#---------------------------------------------------------- | |
# cf-mon monitors a CF app memory and CPU updating the | |
# screen as needed | |
#---------------------------------------------------------- | |
# debugging | |
#set -ex | |
function help() { | |
echo "usage: $0 <app name> [wait]" | |
} | |
function monitor() { | |
local APP_NAME=$1 | |
if [ -z ${APP_NAME} ]; then | |
echo " Missing app name argument" | |
return 1 | |
fi | |
local WAIT=$2 | |
if [ -z ${WAIT} ]; then | |
WAIT=5 | |
fi | |
while : | |
do | |
clear | |
echo " Press CTRL+C to stop monitoring" | |
echo | |
cf app ${APP_NAME} | grep "#" | |
sleep ${WAIT} | |
done | |
} | |
#---------------------------------------------------------- | |
# main | |
#---------------------------------------------------------- | |
if [ -z $1 ]; then | |
help | |
exit 0 | |
fi | |
monitor $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment