Mongrel shutdown function

Hello,

I have a rails application which is running on mongrel. When mongrel server is stopped (terminated by user or by application), I want to run an independent ruby script. Is there any way to do this?

My operating system is Windows XP

Thanks for the help Regards Serdar