CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
How to catch signals from OS (unix)

 



arush_pareek
Novice

Feb 8, 2010, 2:21 AM

Post #1 of 7 (4776 views)
How to catch signals from OS (unix) Can't Post

I am having definition for my signal(SIGUSR2) in one script (say 1.pl)
and the same script 1.pl sends that signal when condition is meet.

I want to capture this signal in script 2 (say 2.pl )

Is there any way through from which my operating system ( unix )can tell me about that signal being called?????

What are the other way if it can`t be done through OS.......


shawnhcorey
Enthusiast


Feb 8, 2010, 5:20 AM

Post #2 of 7 (4771 views)
Re: [arush_pareek] How to catch signals from OS (unix) [In reply to] Can't Post

See `perldoc perlvar` and search for /\%SIG/

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


7stud
Enthusiast

Feb 9, 2010, 12:17 AM

Post #3 of 7 (4731 views)
Re: [arush_pareek] How to catch signals from OS (unix) [In reply to] Can't Post

 

Quote
am having definition for my signal(SIGUSR2)


What is that definition'?


Quote
script 1.pl sends that signal when condition is meet


How does it send the signal? Where does it send the signal?


(This post was edited by 7stud on Feb 9, 2010, 12:18 AM)


arush_pareek
Novice

Feb 9, 2010, 12:54 AM

Post #4 of 7 (4720 views)
Re: [7stud] How to catch signals from OS (unix) [In reply to] Can't Post

Let me make this simple ....

i am having two independent perl script
first script is waiting for some event and when that event happens it need to tell the second script that event occurred.

So i was planning if i could send a signal from first script and the second script could catch that signal
And know that event has occurred


shawnhcorey
Enthusiast


Feb 9, 2010, 9:24 AM

Post #5 of 7 (4704 views)
Re: [arush_pareek] How to catch signals from OS (unix) [In reply to] Can't Post


In Reply To
Let me make this simple ....

i am having two independent perl script
first script is waiting for some event and when that event happens it need to tell the second script that event occurred.

So i was planning if i could send a signal from first script and the second script could catch that signal
And know that event has occurred


See:
perldoc -f kill
perldoc perlvar and search for /\%SIG/

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


7stud
Enthusiast

Feb 9, 2010, 2:40 PM

Post #6 of 7 (4693 views)
Re: [arush_pareek] How to catch signals from OS (unix) [In reply to] Can't Post

To send a signal to a process, you need to know the process id. If the two processes are independent, I don't know how you will obtain the process id of the receiver.


(This post was edited by 7stud on Feb 9, 2010, 2:42 PM)


shawnhcorey
Enthusiast


Feb 10, 2010, 5:12 AM

Post #7 of 7 (4641 views)
Re: [7stud] How to catch signals from OS (unix) [In reply to] Can't Post


In Reply To
To send a signal to a process, you need to know the process id. If the two processes are independent, I don't know how you will obtain the process id of the receiver.


One would record the process id when they started. Otherwise, see `perldoc perlipc`.

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives