#!/sbin/runscript NAME=cassandra DESC="Cassandra" PIDFILE=/var/run/$NAME/$NAME.pid DAEMON=/opt/cassandra/bin/cassandra DAEMON_OPTS="-p $PIDFILE" USER="cassandra" . /opt/cassandra/conf/cassandra-env.sh start() { ebegin "Starting cassandra" [ -e `dirname "$PIDFILE"` ] || \ install -d -ocassandra -gcassandra -m750 `dirname $PIDFILE` start-stop-daemon \ --start \ --user $USER \ --exec $DAEMON \ --quiet \ --pidfile $PIDFILE \ --test >/dev/null || eend 1 start-stop-daemon \ --start \ --user $USER \ --exec $DAEMON \ --background \ --pidfile "$PIDFILE" \ -- $DAEMON_OPTS >/dev/null eend $? } stop() { ebegin "Stopping cassandra" start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE eend $? } restart() { ebegin "Restarting cassandra" start-stop-daemon \ --stop \ --quiet \ --oknodo \ --retry TERM/30/KILL/5 > /dev/null || eend 1 start-stop-daemon \ --start \ --quiet \ --pidfile $PIDFILE \ --chuid $USER \ --exec $DAEMON \ -- $DAEMON_OPTS > /dev/null eend $? }