Reputation: 1
i m trying to write a script which will mail to respective person if a service is crashed.
In windows we have the option for services that if the service is crashed what to do i want to run my script. now problem is that how to find out which service invoked my script??? So that i can email to respective person. e.g. if script is invoked by service A it will send an email to person A and if it is invoked by B it will mail to person B??
Now problem is that how i will find which service invoked my script. is their any way i sn find out which service or which program has invoked my service??
Please reply w.r.t. C# because im using it.
Thanks in Advance
Upvotes: 0
Views: 118
Reputation: 941505
You can't find out. But you don't need to, the configuration is specific to each service. Just pass whatever relevant info that needs to go in the email through the command line. Use the arguments of Main() or Environment.CommandLine to read it back in your C# code.
Upvotes: 2