Hm, I am not making myself clear :o( - It is the status of the ruby script at hand I want to log. $? is probably barking up the wrong tree and adding confusion. In Perl I would do this trapping the signal. > trap in your Ruby script will trap signals for this process not the > forked process - unless you use the block form of fork in which case I > believe the child inherits all signal handlers. #!/usr/bin/env ruby signal = nil trap("INT") { signal = "interupted"; exit } #trap("TERM") { signal = "terminated"; exit } at_exit { puts "Put this in logfile: #{signal}" } sleep 5 I have two issues with this: I loose the stack trace that is normally printed to stderr (I still want that printed to stderr): ./test.rb:10:in `sleep': Interrupt from ./test.rb:10:in `<main>' And I fail setting signal as a global variable (if that can be done?) so I can use it from within a class without getting errors like this: in `block in <class:Biopieces>': undefined local variable or method `signal' for Biopieces:Class (NameError) Cheers, Martin -- Posted via http://www.ruby-forum.com/.