I'm attempting to run Logstash under supervision with runit. My run script for Logstash is simply
#!/bin/sh
SSL_CERT_DIR=/etc/ssl/certs exec /usr/bin/java -jar /usr/local/bin/logstash.jar agent -f /tmp/logstash.conf --log /var/log/logstash.log
If I run this script manually it takes 30 or 45 seconds for the process to properly start up and start doing work, but it will stay up afterwards for a couple hours. However, when I try to do sv start logstash
it executes the script (and Logstash definitely starts because I see output written to /var/log/logstash.log), but after 15 or 20 seconds runit seems to kill and restart the Logstash java process.
I've tried setting the -w
option, but it doesn't seem to wait any longer for the process to run.
How can I have runit properly let this Java process process run and only restart it when it dies?