On 20/01/2011 17:51, Sébastien Druon wrote:
Hello!

I am using cassandra on a ubuntu machine and installed it from the binary found on the cassandra home page.
However, I did not find any scripts to start it up at boot time.

Where can I find this kind of script?

Thanks a lot in advance

Sebastien
Hi, this is what I do, you can add the watchdog to rc.local
/%S[%m]%s %~ %# cat watchdog
#!/bin/bash
#
# This script is to check every $INTERVAL seconds to see
# whether cassandra is work well
# and restart it if neccesary
# by donal 2010-01-11
#
PORT=9160
INTERVAL=2
CASSANDRA=/opt/cassandra
check() {
    netstat -tln|grep LISTEN|grep :$1
    if [ $? != 0 ]; then
        echo "restarting cassandra"
        $CASSANDRA/bin/stop-server
        sleep 1
        $CASSANDRA/bin/start-server
    fi
}
while true
  do check $PORT
  sleep $INTERVAL
done/

Reply via email to