Forum: Ruby Catching system signals (UNIX).

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
67010fb3f7a1afb703d0d8473a01bc1e?d=identicon&s=25 Viacheslav Chumushuk (voice)
on 2009-01-15 09:20
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.
86e33dee4a89a8879a26487051c216a8?d=identicon&s=25 Michael Fellinger (Guest)
on 2009-01-15 09:25
(Received via mailing list)
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
This topic is locked and can not be replied to.