I am using Sinatra for my webapp. I have some cleanup code that I want to execute when my app is being shutdown. Is there a hook for this in Sinatra or do I have to use a separate mechanism?
Look at Kernel#at_exit, I don't see why it shouldn't work in a Sinatra app if you define a block like that somewhere in your main app file.
Update: According to matt's comment, you have to define your at_exit
handler before requiring Sinatra.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With