Commit 34abe012 authored by Georgios Ouzounis's avatar Georgios Ouzounis

LAM-49 Changed Apache Zookeeper and Flink init scripts to user kafka user.

parent b73a1da7
......@@ -11,7 +11,7 @@
- configure-kafka
- name: Start Apache Zookeeper server.
shell: su - kafka -c "/etc/init.d/zookeeper-init start > /dev/null &"
shell: /etc/init.d/zookeeper-init start > /dev/null &
tags:
- start-zookeeper
......@@ -21,7 +21,7 @@
- start-zookeeper
- name: Start Apache Kafka server.
shell: su - kafka -c "/etc/init.d/kafka-init start > /dev/null &"
shell: /etc/init.d/kafka-init start > /dev/null &
tags:
- start-kafka
......
......@@ -8,7 +8,7 @@
- configure-kafka
- name: Start Apache Kafka server.
shell: su - kafka -c "/etc/init.d/kafka-init start > /dev/null &"
shell: /etc/init.d/kafka-init start > /dev/null &
tags:
- start-kafka
......
#!/bin/bash
# Define the user that should run this script.
SCRIPT_USER=kafka
# The path where Apache Kafka is installed.
INSTALLATION_PATH="{{ installation_path }}"
......@@ -13,18 +16,16 @@ 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 --make-pidfile --pidfile $PIDFILE --exec $START_COMMAND
sudo -u $SCRIPT_USER /sbin/start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $START_COMMAND
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
[ $RETVAL -eq 0 ] && $(sudo -u $SCRIPT_USER touch $LOCKFILE)
return $RETVAL
}
stop(){
/sbin/start-stop-daemon --stop --remove-pidfile --pidfile $PIDFILE
sudo -u $SCRIPT_USER /sbin/start-stop-daemon --stop --remove-pidfile --pidfile $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
[ $RETVAL -eq 0 ] && $(sudo -u $SCRIPT_USER rm -f $LOCKFILE)
return $RETVAL
}
......
#!/bin/bash
# Define the user that should run this script.
SCRIPT_USER=kafka
# The path where Apache Zookeeper is installed.
INSTALLATION_PATH="{{ installation_path }}"
......@@ -13,18 +16,16 @@ 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 --make-pidfile --pidfile $PIDFILE --exec $START_COMMAND
sudo -u $SCRIPT_USER /sbin/start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $START_COMMAND
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
[ $RETVAL -eq 0 ] && $(sudo -u $SCRIPT_USER touch $LOCKFILE)
return $RETVAL
}
stop(){
/sbin/start-stop-daemon --stop --remove-pidfile --pidfile $PIDFILE
sudo -u $SCRIPT_USER /sbin/start-stop-daemon --stop --remove-pidfile --pidfile $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
[ $RETVAL -eq 0 ] && $(sudo -u $SCRIPT_USER rm -f $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