For some reason, I can't run logstash as a service. (I had an issue ticket 5 days old, without being touched on elastic/logstash git and forum post across 3 different sites to try and fix it, without luck). I'm okay with that, and now just want it to run from a bash script.
From command line:
cd /opt/logstash
bin/logstash -f [conf_file] > output.txt &
everything works as it should, running in the background and outputting to output.txt. But, when I try to do this via bash with:
cd /opt/logstash
bin/logstash -f /etc/logstash/conf.d/logstash_es.conf > var/log/logstash/logstashconsole.txt &
logstash starts up in the background, but not listening on the ports it needs to be. And, if I try to restart, the old logstash instance doesn't release the ports to which it was bound.
Help?
I know this question is too old to answer. But, my answer will help new users to ELK Stack.
You are doing it correct.
cd /opt/logstash
bin/logstash -f [conf_file] > output.txt &
All you have to do is disown
your process. One way is to remove the job from the shell's job control using the disown shell builtin:
disown
If you have more than one background jobs, include % and the job ID after the command:
disown %1
Confirm that the job is removed from the table of active jobs using the jobs -l
command. To list all running processes, including the disowned use the ps aux
command.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.