cassandra_daemon.sh 382 B

123456789101112131415
  1. #!/bin/bash
  2. while true
  3. do
  4. pid_myself_count=`ps -ef |grep [/]opt/tools/cassandra_daemon.sh |wc -l`
  5. pid_cassandra_count=`ps -ef |grep org.apache.cassandra.service.CassandraDaemon |grep -v grep |wc -l`
  6. if [ $pid_myself_count -gt 2 ]
  7. then
  8. exit 1
  9. fi
  10. if [ $pid_cassandra_count -lt 1 ]
  11. then
  12. cassandra -f >/dev/null 2>&1
  13. fi
  14. sleep 2
  15. done