Skip to content

Instantly share code, notes, and snippets.

@jvshahid
Created June 5, 2017 13:58
Show Gist options
  • Save jvshahid/16d83452f0283cde0705161b68b3a0ee to your computer and use it in GitHub Desktop.
Save jvshahid/16d83452f0283cde0705161b68b3a0ee to your computer and use it in GitHub Desktop.
find desired lrps with unclaimed instances
#!/usr/bin/env bash
source /var/vcap/jobs/cfdot/bin/setup
desired_lrps=$(cfdot desired-lrps | jq -r '.process_guid + " " + (.instances | tostring)')
export IFS=$'\n'
for i in $desired_lrps; do
guid=$(echo $i | awk '{print $1}')
instances=$(echo $i | awk '{print $2}')
running=$(cfdot actual-lrp-groups-for-guid $guid | jq -r -c .instance.state | egrep 'RUNNING|CLAIMED' | wc -l)
if [ $running -ne $instances ]; then
echo "process $guid has $running running instances and $instances desired instances"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment