문제

When the Rails app goes to shutdown what is the procedure that is followed? How can I hook into this to clean-up files that were created during the run of the Rails app?

도움이 되었습니까?

해결책

You can add the following block to config/boot.rb to run commands when the app is shut down:

at_exit do
  puts "Shutting the app down..."
end

This is the output you'll see in your server process:

[Swanny ~/Sites/test_app]$ bundle exec thin start
>> Using rack adapter
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
^C>> Stopping ...
Shutting the app down...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top