summaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb
blob: b8d3cfe136a57486b81782624c7edda3f7c2f420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

CASSANDRA_PASS=<%= @cassandra_pwd %>
CASSANDRA_IP=<%= @cassandra_ip %>
CASSANDRA_PORT=<%= @cassandra_port %>

if [[ $(nodetool status |tail -n2 | grep -Ev "^$"a) == *"UN"* ]]; then
    echo "exit" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP $CASSANDRA_PORT > /dev/null 2>&1
    rc=$?
     if [[ $rc != 0 ]]; then exit $rc; fi
  fi
  exit 0;
else
  echo "Not Up";
  exit 1;
fi