[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Catching system signals (UNIX).

Viacheslav Chumushuk

1/15/2009 8:19:00 AM

Hello.
I have little program (daemon), most of time it waiting with sleep
method.
I need to catch system's signal SIGTERM, to terminate my program
correctly.
How can I do this?

Thanks.
--
Posted via http://www.ruby-....

1 Answer

Michael Fellinger

1/15/2009 8:24:00 AM

0

On Thu, Jan 15, 2009 at 5:19 PM, Viacheslav Chumushuk <voice@root.ua> wrote:
> Hello.
> I have little program (daemon), most of time it waiting with sleep
> method.
> I need to catch system's signal SIGTERM, to terminate my program
> correctly.
> How can I do this?
>
> Thanks.

catch('SIGTERM'){ puts "Oh noes!" }
END{ puts "This is the end, my friend" }

^ manveru