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.
Viacheslav C. (Guest)
on 2009-01-15 10: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.
Michael F. (Guest)
on 2009-01-15 10:25
(Received via mailing list)
On Thu, Jan 15, 2009 at 5:19 PM, Viacheslav C. 
<removed_email_address@domain.invalid>
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.