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

set -x

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

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