Catching system signals (UNIX)


#1

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.


#2

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