#!/bin/bash
while true
do
    pid_myself_count=`ps -ef |grep [/]opt/tools/cassandra_daemon.sh  |wc -l`
    pid_cassandra_count=`ps -ef |grep org.apache.cassandra.service.CassandraDaemon |grep -v grep |wc -l`
    if [ $pid_myself_count -gt 2 ]
    then
        exit 1
    fi
    if [ $pid_cassandra_count -lt 1 ]
    then
        cassandra -f >/dev/null 2>&1
    fi
    sleep 2
done
