I start with rackup --host 0.0.0.0 -p 80
, my config.ru file contains the following:
require_relative 'app/config/initializer'
run Manager.freeze.app
# What I need, but does not work.
at_exit do
Manager.stop_all_services
end
at_exit
does not seem to get hit when I stop my docker-console setup. I don't even know if it works for a normal script.
Does anyone have an idea how to execute some code when I stop the webserver I started with rackup?
Edit: Removed all non-related docker info, since it was distracting from the original question.
As it turned out at_exit
simply works. I think something else in my setup is broken.
Thanks for your time!