I want to shutdown a Sinatra app by sending it a HTTP request like:
get '/shutdown'
# need some code here to stop the app
end
How can this be down?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming that this is only running in one process, you can simply terminate the process with
Kernel.exit. If you want to invoke the Sinatra shutdown handlers, you could try something likeProcess.kill("TERM", Process.pid)to send SIGTERM to the current process.