Commit e3dec450 authored by Georgios Ouzounis's avatar Georgios Ouzounis
Browse files

LAM-49 Created Apache Flink init script.

parent 6f27151f
......@@ -19,10 +19,11 @@
tags:
- configure
- name: Copy Apache Flink init script.
template: src=flink-init.j2 dest=/etc/init.d/flink-init owner=root group=root mode=0755
- name: Start Apache Flink.
shell: "{{ installation_path }}/flink/bin/yarn-session.sh -n {{ number_of_taskmanagers }} -tm {{ ram_per_task_manager }}"
async: 31536000 # Stay alive for a year(1 year = 31536000 seconds).
poll: 0
shell: /etc/init.d/flink-init start # Should use Ansible module "service: name=flink-init state=started" when the bug in version 1.9.1 is fixed.
tags:
- start
#!/bin/bash
# The path where Apache Flink is installed.
INSTALLATION_PATH="{{ installation_path }}"
# The full path of the pid file to use.
PIDFILE="$INSTALLATION_PATH/flink/flink.pid"
# The full path of the lock file to use.
LOCKFILE="$INSTALLATION_PATH/flink/flink-lock"
# The command that will start Apache Flink.
START_COMMAND="$INSTALLATION_PATH/flink/bin/yarn-session.sh -n {{ number_of_taskmanagers }} -tm {{ ram_per_task_manager }}"
start(){
touch $PIDFILE
nohup $START_COMMAND & echo $! > $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop(){
kill -s 9 $(cat $PIDFILE)
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
return $RETVAL
}
restart(){
stop
start
}
RETVAL=0
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
restart
;;
condrestart)
[ -f $LOCKFILE ] && restart || :
;;
status)
ps -p $(cat $PIDFILE)
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
RETVAL=1
esac
exit $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