Skip to content

Instantly share code, notes, and snippets.

@uemuraj
Created October 24, 2012 05:10
Show Gist options
  • Save uemuraj/3944078 to your computer and use it in GitHub Desktop.
Save uemuraj/3944078 to your computer and use it in GitHub Desktop.
Cassandra 用のデーモンスクリプト
#!/bin/sh
### BEGIN INIT INFO
# Provides: cassandra
# Required-Start: $local_fs $remote_fs $network $time $named
# Should-Start: $time sendmail
# Required-Stop: $local_fs $remote_fs $network $time $named
# Should-Stop: $time sendmail
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Cassandra key value store serer
# Description: Start the Cassandra key value store serer
### END INIT INFO
export JAVA_HOME=/opt/jdk1.7.0_09
export CASSANDRA_HOME=/opt/apache-cassandra-1.1.6
. /etc/init.d/functions
CASSANDRA_PID_FILE="/var/run/cassandra.pid"
RETVAL=0
case "$1" in
start)
echo -n "Starting Cassandra "
"$CASSANDRA_HOME/bin/cassandra" -p "$CASSANDRA_PID_FILE" > /dev/null
RETVAL=$?
if [ $RETVAL = 0 ]; then
echo_success
else
echo_failure
fi
echo
;;
stop)
echo -n "Shutting down Cassandra "
killproc -p "$CASSANDRA_PID_FILE" cassandra
RETVAL=$?
echo
;;
status)
status -p "$CASSANDRA_PID_FILE" cassandra
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment