You could have saved a lot of your valuable time if you had read...
> > I need to send sms alert for the process that r
> not
> > running.



Anyways that was very kind.




Satya Prasad <[EMAIL PROTECTED]>

11/09/2004 02:58 PM

Please respond to
[EMAIL PROTECTED]

To
[EMAIL PROTECTED]
cc
Subject
Re: [c-prog] Process iD.   !!!URGENT......!!






I will presume within my description 'alert' as
'signal' notification to the parent process when any
child process exits.

Unix shell provides an interface to the UNIX operating
system. Commands are entered in one or more words
separated by blanks. The Unix shell creates a new
process using the system call fork() to execute the
command as entered. The execution environment for the
command includes input, output and the states of
signals, and is established in the child process
before the command is executed.

Signals, are notifications sent to a process in order
to notify it of various "important" events. They
interrupt the process , and force it to handle it
immediately. Each signal has an integer number that
represents it (1, 2 and so on), as well as a symbolic
name that is usually defined in the file
/usr/include/signal.h.

Each signal may have a signal handler, which is a
function that gets called when the process receives
that signal. The function is called in "asynchronous
mode", meaning that nowhere in your program you have
code that calls this function directly. Instead, when
the signal is sent to the process, the operating
system stops the execution of the process, and
"forces" it to call the signal handler function. When
that signal handler function returns, the process
continues execution from wherever it happened to be
before the signal was received, as if this
interruption never occurred.

Most signals may be caught by the process, but there
are a few signals that the process cannot catch, and
cause the process to terminate. If you install no
signal handlers of your own , the runtime environment
sets up a set of default signal handlers for your
program.

The signal requested in concern of this thread is
'SIGCHLD'. The 'SIGCHLD' signal is sent to parent on
child stop or exit. The parent can be the Unix Shell
or another process. Use 'trap' for catching the signal
at Unix shell level

At process level Unix provides many routines and
methods of implementation. Below is a small example:

#include <stdio.h>
#include <stdlib.h>

int main ( )
{
pid_t pid ;
int times , status ;
if ( pid=fork( ) )
{
printf ("PID = [%d]\n" , pid ) ;
}
else
{
sleep ( 5 ) ;
exit ( EXIT_SUCCESS ) ;
}
if ( pid=fork( ) )
{
printf ("PID = [%d]\n" , pid ) ;
}
else
{
sleep ( 5 ) ;
exit ( EXIT_SUCCESS ) ;
}

while ( (pid = wait ( &status ) ) > 0 )
{
printf ( "Child PID [%d] Killed\n" , pid ) ;
}
}

The 'wait' subroutine waits for a child process to
stop or terminate. The  wait() function suspends
execution of the calling process until status
information for one of its terminated child processes
is available, or until delivery of a signal whose
action is either to execute a signal-catching function
or to terminate the process.  If status information is
available prior to the call to wait(), return is
immediate. The effect of the wait () function can be
modified by setting the SIGCHLD signal. For example
visit the following links:
<http://www.erlenstar.demon.co.uk/unix/faq_2.html>
<http://users.actcom.co.il/~choo/lupg/tutorials/multi-process/multi-process.html>

Hope this helps.

Regards,
Satya Prakash Prasad.


--- piyu sen <[EMAIL PROTECTED]> wrote:

> Yes i have all of them
>
> [EMAIL PROTECTED] wrote:
> >>>i want to generate allerts for the process that r
> not running???
>
> So..Do you have a list of processes that should be
> running???
> Only then can you check which processes are running
> and then send alerts for those that are not running!
>
>
> Thanks.
>
>
>
> piyu sen <[EMAIL PROTECTED]>
> 11/09/2004 12:39 PM
> Please respond to
> [EMAIL PROTECTED]
>
>
> To
> [EMAIL PROTECTED], [EMAIL PROTECTED],
> [EMAIL PROTECTED] cc
> Subject
> Re: [c-prog] Process iD.   !!!URGENT......!!
>
>
>
>
> i want to generate allerts for the process that r
> not running
>
> Mahesh Menase <[EMAIL PROTECTED]> wrote:
> if process id is 0 then ...........
>  
> :) ......... go Home.
>
> piyu sen <[EMAIL PROTECTED]> wrote:
> ok
> if the process id is 0 then
>
> Satya Prasad <[EMAIL PROTECTED]> wrote:
>
> I would like to help you ... but how can a
> terminated
> process have a process Id.
>
> Regards,
> Satya Prakash Prasad.
>
> --- piyu sen <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > Can ne 1 tel me what will b the Process id for a
> > process that have been normaly terminated or
> > terminated by fource..
> > I need to send sms allert for the process that r
> not
> > running.
> > Plz help me.
> > U can call me in this number or give ur number so
> > that i can talk to u in this regard
> > 9811425054.
> > Thanks
> > Regards Piyu
> >
> >                  
> > ---------------------------------
> > Do you Yahoo!?
> >  Check out the new Yahoo! Front Page.
> www.yahoo.com
>
>
>
>            
> __________________________________
> Do you Yahoo!?
> Check out the new Yahoo! Front Page.
> www.yahoo.com
>
>
>
>
> To unsubscribe, send a blank message to
> <mailto:[EMAIL PROTECTED]>.
>
>
>
>
> Piyu Sen
> Software Engineer.
> SSL. Bangalore.
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
> To unsubscribe, send a blank message to
> <mailto:[EMAIL PROTECTED]>.
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Check out the new Yahoo! Front Page. www.yahoo.com
>
> To unsubscribe, send a blank message to
> <mailto:[EMAIL PROTECTED]>.
>
>
>
>
> Piyu Sen
> Software Engineer.
> SSL. Bangalore.
>
> ---------------------------------
> Do you Yahoo!?
> Check out the new Yahoo! Front Page. www.yahoo.com
>
> To unsubscribe, send a blank message to
> <mailto:[EMAIL PROTECTED]>.
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
>
>
>
>
>
> ---------------------------------
> Yahoo! Groups Links
>    To visit your group on the web, go to:
> http://groups.yahoo.com/group/c-prog/
>  
>    To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>  
>    Your use of Yahoo! Groups is subject to the
> Yahoo! Terms of Service.
> ForwardSourceID:NT0000727A    
> DISCLAIMER: The information contained in this
> message is intended only and solely for the
> addressed individual or entity indicated in this
> message and for the exclusive use of the said
> addressed individual or entity indicated in this
> message (or responsible for delivery of the message
> to such person) and may contain legally privileged
> and confidential information belonging to Tata
> Consultancy Services Limited. It must not be
> printed, read, copied, disclosed, forwarded,
> distributed or used (in whatsoever manner) by any
> person other than the addressee. Unauthorized use,
> disclosure or copying is strictly prohibited and may
> constitute unlawful act and can possibly attract
> legal action, civil and/or criminal. The contents of
> this message need not necessarily reflect or endorse
> the views of Tata Consultancy Services limited on
> any subject matter.
> Any action taken or omitted to be taken based on
> this message is entirely at your risk and neither
> the originator of this message nor Tata Consultancy
> Services Limited takes any responsibility or
> liability towards the same. Opinions, conclusions
> and any other information contained in this message
> that do not relate to the official business of Tata
> Consultancy Services limited shall be understood as
> neither given nor endorsed by Tata Consultancy
> Services Limited or any affiliate of Tata
> Consultancy Services Limited. If you have received
> this message in error, you should destroy this
> message and may please notify the sender by e-mail.
> Thank you.
>
>
> To unsubscribe, send a blank message to
> <mailto:[EMAIL PROTECTED]>.
>
>
> Yahoo! Groups SponsorADVERTISEMENT
>
>
> ---------------------------------
> Yahoo! Groups Links
>
>    To visit your group on the web, go to:
> http://groups.yahoo.com/group/c-prog/
>  
>    To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>  
>    Your use of Yahoo! Groups is subject to the
> Yahoo! Terms of Service.
>
>
>
>
>
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~->

To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links

<*> To visit your group on the web, go to:
   http://groups.yahoo.com/group/c-prog/

<*> To unsubscribe from this group, send an email to:
   [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
   http://docs.yahoo.com/info/terms/





ForwardSourceID:NT000072BA    
DISCLAIMER: The information contained in this message is intended only and solely for the addressed individual or entity indicated in this message and for the exclusive use of the said addressed individual or entity indicated in this message (or responsible for delivery of the message to such person) and may contain legally privileged and confidential information belonging to Tata Consultancy Services Limited. It must not be printed, read, copied, disclosed, forwarded, distributed or used (in whatsoever manner) by any person other than the addressee. Unauthorized use, disclosure or copying is strictly prohibited and may constitute unlawful act and can possibly attract legal action, civil and/or criminal. The contents of this message need not necessarily reflect or endorse the views of Tata Consultancy Services limited on any subject matter.
Any action taken or omitted to be taken based on this message is entirely at your risk and neither the originator of this message nor Tata Consultancy Services Limited takes any responsibility or liability towards the same. Opinions, conclusions and any other information contained in this message that do not relate to the official business of Tata Consultancy Services limited shall be understood as neither given nor endorsed by Tata Consultancy Services Limited or any affiliate of Tata Consultancy Services Limited. If you have received this message in error, you should destroy this message and may please notify the sender by e-mail.
Thank you.


To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=977869921


Yahoo! Groups Links

Reply via email to