summaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb
diff options
context:
space:
mode:
Diffstat (limited to 'sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb')
-rw-r--r--sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb16
1 files changed, 16 insertions, 0 deletions
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb
new file mode 100644
index 0000000000..2f97d0768e
--- /dev/null
+++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/ready-probe.sh.erb
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+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
+