Commit f8b32c7d authored by Georgios Ouzounis's avatar Georgios Ouzounis

LAM-49 refactored init scripts to show the same response on status switch.

parent 4dadd20d
......@@ -6,9 +6,6 @@ source /etc/environment
# 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"
......@@ -19,11 +16,8 @@ START_COMMAND="$INSTALLATION_PATH/flink/bin/yarn-session.sh -n {{ number_of_task
# before Flink's deployment.
STOP_COMMAND="$HADOOP_HOME/bin/yarn application --kill"
# The command that will return the status of Apache Flink.
STATUS_COMMAND="$HADOOP_HOME/bin/yarn application -status"
start(){
nohup $START_COMMAND &
nohup $START_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
......@@ -31,7 +25,7 @@ start(){
stop(){
id=$($HADOOP_HOME/bin/yarn application --list | grep "Flink session" | cut -f1)
nohup $STOP_COMMAND $id &
nohup $STOP_COMMAND $id > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
return $RETVAL
......@@ -58,8 +52,7 @@ case "$1" in
[ -f $LOCKFILE ] && restart || :
;;
status)
id=$($HADOOP_HOME/bin/yarn application --list | grep "Flink session" | cut -f1)
$STATUS_COMMAND $id
[ -f $LOCKFILE ] && echo "Apache Flink is running." || echo "Apache Flink is not running."
RETVAL=$?
;;
*)
......
......@@ -15,18 +15,15 @@ START_COMMAND="$INSTALLATION_PATH/hadoop/sbin/start-dfs.sh"
# The command that will stop Apache HDFS.
STOP_COMMAND="$INSTALLATION_PATH/hadoop/sbin/stop-dfs.sh"
# The command that will return the status of Apache HDFS.
STATUS_COMMAND="$INSTALLATION_PATH/hadoop/bin/hdfs dfsadmin -report"
start(){
nohup $START_COMMAND &
nohup $START_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop(){
nohup $STOP_COMMAND &
nohup $STOP_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
return $RETVAL
......@@ -53,7 +50,7 @@ case "$1" in
[ -f $LOCKFILE ] && restart || :
;;
status)
$STATUS_COMMAND
[ -f $LOCKFILE ] && echo "Apache HDFS is running." || echo "Apache HDFS is not running."
RETVAL=$?
;;
*)
......
......@@ -16,14 +16,14 @@ START_COMMAND="$INSTALLATION_PATH/hadoop/sbin/start-yarn.sh"
STOP_COMMAND="$INSTALLATION_PATH/hadoop/sbin/stop-yarn.sh"
start(){
nohup $START_COMMAND &
nohup $START_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
stop(){
nohup $STOP_COMMAND &
nohup $STOP_COMMAND > /dev/null &
RETVAL=$?
[ $RETVAL -eq 0 ] && $(rm -f $LOCKFILE)
return $RETVAL
......@@ -50,7 +50,7 @@ case "$1" in
[ -f $LOCKFILE ] && restart || :
;;
status)
[ -f $LOCKFILE ] && echo "Hadoop Yarn is running." || echo "Hadoop Yarn is not running."
[ -f $LOCKFILE ] && echo "Apache Yarn is running." || echo "Apache Yarn is not running."
RETVAL=$?
;;
*)
......
......@@ -14,7 +14,7 @@ START_COMMAND="$INSTALLATION_PATH/kafka/bin/kafka-server-start.sh $INSTALLATION_
start(){
touch $PIDFILE
nohup $START_COMMAND & echo $! > $PIDFILE
nohup $START_COMMAND > /dev/null & echo $! > $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
......@@ -48,7 +48,7 @@ case "$1" in
[ -f $LOCKFILE ] && restart || :
;;
status)
ps -p $(cat $PIDFILE)
[ -f $LOCKFILE ] && echo "Apache Kafka is running." || echo "Apache kafka is not running."
RETVAL=$?
;;
*)
......
......@@ -14,7 +14,7 @@ START_COMMAND="$INSTALLATION_PATH/kafka/bin/zookeeper-server-start.sh $INSTALLAT
start(){
touch $PIDFILE
nohup $START_COMMAND & echo $! > $PIDFILE
nohup $START_COMMAND > /dev/null & echo $! > $PIDFILE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
......@@ -48,7 +48,7 @@ case "$1" in
[ -f $LOCKFILE ] && restart || :
;;
status)
ps -p $(cat $PIDFILE)
[ -f $LOCKFILE ] && echo "Apache Zookeeper is running." || echo "Apache Zookeeper is not running."
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