mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-21 19:42:24 +01:00
42 lines
837 B
Text
42 lines
837 B
Text
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
CASSANDRA_BIN_PATH="/opt/apache-cassandra/bin"
|
||
|
PID_FILE="/var/run/cassandra.pid"
|
||
|
|
||
|
stop_cassandra(){
|
||
|
kill `cat $PID_FILE`
|
||
|
rm -f $PID_FILE
|
||
|
}
|
||
|
|
||
|
if [ ! -d $CASSANDRA_BIN_PATH ]; then
|
||
|
echo
|
||
|
echo "Cassandra is not installed on this machine!"
|
||
|
echo "Please check cassandra installation or set var CASSANDRA_BIN_PATH properly"
|
||
|
echo
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
case $1 in
|
||
|
start)
|
||
|
echo " * Starting Cassandra..."
|
||
|
$CASSANDRA_BIN_PATH/cassandra -p $PID_FILE > /dev/null 2>&1
|
||
|
;;
|
||
|
stop)
|
||
|
echo " * Stopping Cassandra..."
|
||
|
stop_cassandra
|
||
|
;;
|
||
|
restart)
|
||
|
echo " * Rerstarting Cassandra..."
|
||
|
stop_cassandra
|
||
|
sleep 3
|
||
|
$CASSANDRA_BIN_PATH/cassandra -p $PID_FILE > /dev/null 2>&1
|
||
|
;;
|
||
|
*)
|
||
|
echo " * Please provide correct option between start|stop|restart"
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
|