From: Dean Holdren Date: 2007-09-29T05:55:21+09:00 Subject: trapping TERM in a daemonized (Daemon gem) script I'm using the Daemon gem, and I'd like to trap the TERM signal so that I can have graceful termination of my main execution loop: $running = true; Signal.trap("TERM") do $running = false end while($running) do #some operations that could take a few seconds sleep(5) end However, I get some memory errors when I stop the process, and I can sometimes get an extra process after a 'restart' is issued, that I can't kill with a 'stop' I looked at the source to the Daemon gem, and it warns not to trap the TERM signal in your script. So how can I gracefully end my loop if I don't trap TERM?