Commit fb490056 authored by Georgios Ouzounis's avatar Georgios Ouzounis

LAM-49 Apache Kafka init scripts finalized.

parent f211316b
......@@ -11,7 +11,7 @@
- configure-kafka
- name: Start Apache Zookeeper server.
shell: /etc/init.d/zookeeper-init start # Should use Ansible module "service: name=zookeeper-init state=started" when the bug in version 1.9.1 is fixed.
shell: su - kafka -c "/etc/init.d/zookeeper-init start > /dev/null &"
tags:
- start-zookeeper
......@@ -21,7 +21,7 @@
- start-zookeeper
- name: Start Apache Kafka server.
shell: /etc/init.d/kafka-init start # Should use Ansible module "service: name=kafka-init state=started" when the bug in version 1.9.1 is fixed.
shell: su - kafka -c "/etc/init.d/kafka-init start > /dev/null &"
tags:
- start-kafka
......
......@@ -8,7 +8,7 @@
- configure-kafka
- name: Start Apache Kafka server.
shell: /etc/init.d/kafka-init start # Should use ansible module service: name=zookeeper-init state=started when the bug in version 1.9.1 is fixed.
shell: su - kafka -c "/etc/init.d/kafka-init start > /dev/null &"
tags:
- start-kafka
......
#!/bin/bash
# Define the user that should run the service.
SERVICE_USER=kafka
# Define the group in which SERVICE_USER belongs.
SERVICE_GROUP=lambda
# The path where Apache Kafka is installed.
INSTALLATION_PATH="{{ installation_path }}"
......@@ -19,17 +13,11 @@ LOCKFILE="$INSTALLATION_PATH/kafka/kafka-lock"
START_COMMAND="$INSTALLATION_PATH/kafka/bin/kafka-server-start.sh $INSTALLATION_PATH/kafka/config/server.properties"
start(){
/sbin/start-stop-daemon --start --background --chuid $SERVICE_USER:$SERVICE_GROUP --make-pidfile --pidfile $PIDFILE --exec $START_COMMAND
chown $SERVICE_USER $PIDFILE
chgrp $SERVICE_GROUP $PIDFILE
/sbin/start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $START_COMMAND
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
chown $SERVICE_USER $LOCKFILE
chgrp $SERVICE_GROUP $LOCKFILE
return $RETVAL
}
......
#!/bin/bash
# Define the user that should run the service.
SERVICE_USER=kafka
# Define the group in which SERVICE_USER belongs.
SERVICE_GROUP=lambda
# The path where Apache Zookeeper is installed.
INSTALLATION_PATH="{{ installation_path }}"
......@@ -19,17 +13,11 @@ LOCKFILE="$INSTALLATION_PATH/kafka/zookeeper-lock"
START_COMMAND="$INSTALLATION_PATH/kafka/bin/zookeeper-server-start.sh $INSTALLATION_PATH/kafka/config/zookeeper.properties"
start(){
/sbin/start-stop-daemon --start --background --chuid $SERVICE_USER:$SERVICE_GROUP --make-pidfile --pidfile $PIDFILE --exec $START_COMMAND
chown $SERVICE_USER $PIDFILE
chgrp $SERVICE_GROUP $PIDFILE
/sbin/start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $START_COMMAND
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
chown $SERVICE_USER $LOCKFILE
chgrp $SERVICE_GROUP $LOCKFILE
return $RETVAL
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment