views:

165

answers:

2

Hello,
I created a Server that listens for HTTP connections all the time. It's a default Console Application and runs on a Linux Machine using Mono (2.4).

The Problem is that i want this Server to move itself to the background (deamonize itself). I couldn't find a Solution on Google and mono Server.exe & is not really what i'm looking for (the effect is the correct, i just want the program to do it itself), eventhough it works for the moment.

Any hints/ideas?

+1  A: 

Well about the best it can do is span another copy of itself with system.diagnositics.process.

If you're willing to be *nix specific you can P/Invoke daemonize(), which is: fork(), and parent calls _exit while child calls setpgrp(0).

Joshua
Thanks, this should work, eventhough it feels a little clumsy. I'll try it but i hope someone else knows something simpler and more straight forward.
dbemerlin
A: 

I'm using mono-service now.

dbemerlin