This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

cassandra/cassandra

By: a guest on Jan 24th, 2011  |  syntax: Bash  |  size: 0.74 KB  |  views: 141  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. . /etc/rc.conf
  4. . /etc/rc.d/functions
  5.  
  6. PIDFILE=/var/run/cassandra.pid
  7. if [ -f "$PIDFILE" ]; then
  8.         PID=`cat /var/run/cassandra.pid`
  9. fi
  10. case "$1" in
  11.   start)
  12.     stat_busy "Starting Cassandra Daemon"
  13.     [ -z "$PID" ] && /usr/bin/cassandra -p $PIDFILE &> /dev/null
  14.     if [ $? -gt 0 ]; then
  15.       stat_fail
  16.     else
  17.       add_daemon cassandra
  18.       stat_done
  19.     fi
  20.     ;;
  21.   stop)
  22.     stat_busy "Stopping Cassandra Daemon"
  23.     [ ! -z "$PID" ]  && kill $PID &> /dev/null
  24.     if [ $? -gt 0 ]; then
  25.       stat_fail
  26.     else
  27.       rm $PIDFILE
  28.       rm_daemon cassandra
  29.       stat_done
  30.     fi
  31.     ;;
  32.   restart)
  33.     $0 stop
  34.     sleep 1
  35.     $0 start
  36.     ;;
  37.   *)
  38.     echo "usage: $0 {start|stop|restart}"  
  39. esac
  40. exit 0
clone this paste RAW Paste Data