Logstash upload to Elastic search works in Command Line but hangs when run through shell script

Executing logstash in command line worked successfully but putting the same command with the JAVA_HOME & PATH variables set & exported in a shell script doesnt work. While running the shell script, logstash comes to the point showing the below, then it hangs/goes into an idefinite loop (on seeing the --debug output);

Settings: Default pipeline workers: 16
Logstash startup completed

With the --debug and -v option in the logstash command, it repeats the below message continuously;
**Flushing buffer at interval **

Why does it hang or go into indefinite loop while executing the same in a shell script ?

Note : ConfigTest is OK in both command line and shell script.

Executing Logstash in Command Line in RHEL 5.8
$ JAVA_HOME=../java/jdk1.8.0_77/bin
$ export PATH=$JAVA_HOME:$PATH
$ ../logstash-2.2.2/bin/logstash -f _config_file < _data_file

config_file
input {
stdin { }
}

filter {
grok {
match => {
"message" => "(?<timestamp>\d{,4}-\d{,2}-\d{,2}\s\d{,2}:\d{,2}:\d{,2}),(?[\w_-]),(?[\d]+),(?[\w\d.]),(?[\w\d.]),(?[\w\d.]),(?[\d.]),(?[\w;\s])"
}
}

date {
match => [ "timestamp", "YYYY-MM-dd HH:mm:ss" ]
}

mutate {
convert => { "size" => "float" }
convert => { "count" => "integer" }
remove_field => [ "message", "@version", "_id", "_index", "_type", "host" ]
}
}

output {
stdout { codec => dots }
elasticsearch {
hosts => ""
index => ""
}
}

data_file
2010-10-10 10:10:10,name,1111,2222,3333,4444,5555,abc

What does your script look like?
Why aren't you just using the RPM?

Hi Mark,

Thank you for your response;

Script looks like the below;

#!/usr/bin/sh
JAVA_HOME=../java/jdk1.8.0_77/bin
export PATH=$JAVA_HOME:$PATH
CONFIGFILE=configFilePath
DATAFILE=dataFilePath

../logstash-2.2.2/bin/logstash --configtest -f CONFIGFILE < DATAFILE
sleep 10
../logstash-2.2.2/bin/logstash -f CONFIGFILE < DATAFILE

I downloaded the tar.gz file for the Linux O/S which I untarred as logstash-2.2.2, and using logstash as above. I'll try the RPM as well

Same result with RPM as well. logstash command hangs and goes into indefinite loop in debug.