Skip to content

Instantly share code, notes, and snippets.

@mpenick
Created September 30, 2016 19:26
Show Gist options
  • Select an option

  • Save mpenick/3edbbbbc2ebbcc301c02d6e23803ee0e to your computer and use it in GitHub Desktop.

Select an option

Save mpenick/3edbbbbc2ebbcc301c02d6e23803ee0e to your computer and use it in GitHub Desktop.
#!/bin/bash
trap "kill -9 $$" SIGINT SIGTERM
while true; do
echo -n "Checking node$1..."
START=$(date +%s)
echo "quit" | ccm node$1 cqlsh > /dev/null 2>&1
RESULT=$?
END=$(date +%s)
DIFF=$(echo "$END - $START" | bc)
if [ $RESULT == 0 ]; then
echo "available. ($DIFF)";
else
echo "down. ($DIFF)";
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment