Sample Header Ad - 728x90

How to make bash script invoking logstash return prompt

1 vote
1 answer
575 views
For various reasons, I am not running logstash (7.10.1) as a service, but rather invoking it on-demand, in a bash script: /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/my_ls.conf & echo "" echo "#########################################################" read -p "Press enter to continue " It works well, but when finishing to create an elasticsearch index successfully, it always pauses with: [INFO ] [[main]-pipeline-manager] javapipeline - Pipeline Java execution initialization time {"seconds"=>1.3} [INFO ] [[main]-pipeline-manager] javapipeline - Pipeline started {"pipeline.id"=>"main"} [INFO ] [[main]1, :running_pipelines=>[:main], :non_running_pipelines=>[]} [INFO ] [Api Webserver] agent - Successfully started Logstash API endpoint {:port=>9600} In order to make it return to the CLI prompt, I need to run from another SSH terminal the following: pkill -f logstash This is of course inconvenient and I am looking for a way to make the bash script prompt with "Press any key to exit". My problem is that the statements after the logstash invocation (with the & appended), including the prompt read -p "Press enter to continue" are displayed before logstash actually starts doing its work and the bash script never exits to the CLI prompt. What is the proper way to make the bash script prompt with "Press any key to exit" when logstash finishes the index creation?
Asked by datsb (323 rep)
Jan 4, 2022, 04:00 PM
Last activity: Jan 5, 2022, 02:49 PM