Skip to content

Instantly share code, notes, and snippets.

@xman1980
Created May 19, 2015 17:44
Show Gist options
  • Save xman1980/278c70a89206724fdef5 to your computer and use it in GitHub Desktop.
Save xman1980/278c70a89206724fdef5 to your computer and use it in GitHub Desktop.
confluent.io init.d zookeeper
DAEMON_PATH=/usr/bin
DAEMON_NAME=zookeeper
# Check that networking is up.
#[ ${NETWORKING} = "no" ] && exit 0
PATH=$PATH:$DAEMON_PATH
# See how we were called.
case "$1" in
start)
# Start daemon.
echo "Starting $DAEMON_NAME";
nohup $DAEMON_PATH/zookeeper-server-start -daemon /etc/kafka/zookeeper.properties
;;
stop)
# Stop daemons.
echo "Shutting down $DAEMON_NAME";
pid=`ps ax | grep -i 'zookeeper' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
kill -9 $pid
else
echo "Zookeeper was not Running"
fi
;;
restart)
$0 stop
sleep 2
$0 start
;;
status)
pid=`ps ax | grep -i 'zookeeper' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
echo "Zookeeper is Running as PID: $pid"
else
echo "Zookeeper is not Running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment