Logstash init script bug

When logstash doesn't stop in a timely manner, the init script exits with a bug trying to handle the timeout, and when calling it with restart, it ends up starting multiple copies.

sudo service logstash restart
Killing logstash (pid 23698) with SIGTERM
Waiting logstash (pid 23698) to die...
Waiting logstash (pid 23698) to die...
Waiting logstash (pid 23698) to die...
Waiting logstash (pid 23698) to die...
Waiting logstash (pid 23698) to die...
Waiting logstash (pid 23698) to die...
Waiting logstash (pid 23698) to die...
Waiting logstash (pid 23698) to die...
Waiting logstash (pid 23698) to die...
/etc/init.d/logstash: 99: [: -eq: unexpected operator
logstash stop failed; still running.
logstash started.

Seen in version 2.3.1 on ubuntu 14 LTS

The relevant line in the code is...

  if [ $KILL_ON_STOP_TIMEOUT -eq 1 ] ; then

...and that variable doesn't exist anywhere in a default configuration, hence the init script bugs out.

Addtionally, after reviewing the code further, when the else clause to the line with the bug fires, the script should not start another copy. The stop function should return an error so that "stop && start" does not do the start.

When I wrote this, I had failed to find an existing issue about it. I found one that is similar so I commented on it.