-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkafka.sh
More file actions
47 lines (44 loc) · 1.09 KB
/
kafka.sh
File metadata and controls
47 lines (44 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#/etc/init.d/kafka
KAFKA_ROOT_PATH=
KAFKA_PATH=$KAFKA_ROOT_PATH/bin
KAFKA_PROCESS_NAME=kafka
# Check that networking is up.
#[ ${NETWORKING} = "no" ] && exit 0
PATH=$PATH:$KAFKA_PATH
# See how we were called.
case "$1" in
start)
# Start daemon.
pid=`ps ax | grep -i 'kafka.Kafka' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
echo "Kafka is already running"
else
echo "Starting $KAFKA_PROCESS_NAME"
$KAFKA_PATH/kafka-server-start.sh -daemon $KAFKA_ROOT_PATH/config/server.properties
fi
;;
stop)
echo "Shutting down $KAFKA_PROCESS_NAME"
$KAFKA_PATH/kafka-server-stop.sh
;;
restart)
$0 stop
sleep 2
$0 start
;;
status)
pid=`ps ax | grep -i 'kafka.Kafka' | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]
then
echo "Kafka is Running as PID: $pid"
else
echo "Kafka is not Running"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0