summaryrefslogtreecommitdiff
path: root/system/kafka/rc.kafka
diff options
context:
space:
mode:
authorAndre Barboza <bmg.andre@gmail.com>2016-01-12 06:59:10 +0700
committerRobby Workman <rworkman@slackbuilds.org>2016-01-12 21:58:11 -0600
commit39a56c19d093caa0d33d40f25be1a0f36e6b62a9 (patch)
tree53a885c9d500280d63fc7ddd05f7c721387081e0 /system/kafka/rc.kafka
parentaa59088973d5d87c7ed9875b91bb6a202735e1bd (diff)
downloadslackbuilds-39a56c19d093caa0d33d40f25be1a0f36e6b62a9.tar.gz
system/kafka: Added (high-throughput distributed messaging system).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/kafka/rc.kafka')
-rw-r--r--system/kafka/rc.kafka40
1 files changed, 40 insertions, 0 deletions
diff --git a/system/kafka/rc.kafka b/system/kafka/rc.kafka
new file mode 100644
index 0000000000..12d74bc8b7
--- /dev/null
+++ b/system/kafka/rc.kafka
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Start/stop/restart Apache Zookeeper daemon
+
+SERVER_CONFIG=(server.properties)
+
+USER=kafka
+kafka_start(){
+ for conf in ${SERVER_CONFIG[@]}; do
+ sudo -u ${USER} sh -c "/usr/bin/kafka-server-start.sh -daemon /etc/kafka/${conf}"
+ done
+}
+
+kafka_stop() {
+ sudo -u ${USER} sh -c "/usr/bin/kafka-server-stop.sh"
+}
+
+kafka_restart() {
+ kafka_start
+ sleep 1
+ kafka_stop
+}
+
+print_usage() {
+ echo "usage $0 start|stop|restart"
+}
+
+case "$1" in
+ 'start')
+ kafka_start
+ ;;
+ 'stop')
+ kafka_stop
+ ;;
+ 'restart')
+ kafka_restart
+ ;;
+ *)
+ print_usage
+ ;;
+esac