Click here to Skip to main content
15,891,841 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I have a server process which is deployed now, and I want to keep my server running.
In case, if that process crashed by some means, either some exception or any other technical flow, then I need it to be restart again.

For this, I have created another process which keep checking(e.g, every 2 minutes) in processes list for this particular process name, and in case, if not found, it will start that process.

I have implemented this solution, but I know its not a good idea, I believe there must be some better ideas for this job. Can you help me is it best approach, or suggest some better one?

Thanks.
Posted
Updated 3-Feb-12 0:02am
v2
Comments
LanFanNinja 3-Feb-12 2:04am    
It would probably help someone to answer you if you would tell what language you have used to implement all this.
Muhammad Idrees GS 3-Feb-12 2:50am    
Sorry i forgot to mentioned, I am using C#.net, VisualStudio 2010

1 solution

First of all if it works for you I wouldn't exactly say it's a bad idea. There might be a problem though if your watchdog program itself would stop functioning (crash) for some reason. If you are absolutely bent on changing your setup my advice to you would be to make a windows service out of your server process if it isn't already one. Then all you have to do is configure the windows service recovery options. These recovery options can be set from within your installer. Please see here for details: Set Recovery Options in Properties of Windows Service[^].

Regards,

Manfred
 
Share this answer
 
Comments
Muhammad Idrees GS 6-Feb-12 1:01am    
Thanks Manfred,

That's the point I was also thinking that if watchdog application could also crash, then this approach would not be the good one. and also I have to setup both processes when go for deployment.

Second windows service option seems better option, and I think I have to switch for that solution ultimately.

Thanks a lot for your valuable suggestion.
Manfred Rudolf Bihy 6-Feb-12 8:13am    
You are welcome! Come back any time :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900