Fork me on GitHub

How to install daemons?

Gentoo Mono Handbook
services
we don't know

http://stackoverflow.com/questions/186493/how-do-i-code-a-mono-daemon
    You should implement a service and use mono-service.


http://stackoverflow.com/questions/3660039/success-with-start-stop-daemon-and-mono-service2
    We had a lot of issues with mono-service and ended up implementing our own "service" code in our app. Nothing hard, just grabbing some signals:

UnixSignal intr = new UnixSignal (Signum.SIGINT);
UnixSignal term = new UnixSignal (Signum.SIGTERM);
UnixSignal hup = new UnixSignal (Signum.SIGHUP);
UnixSignal usr2 = new UnixSignal (Signum.SIGUSR2);

UnixSignal[] signals = new UnixSignal[] { intr, term, hup, usr2 };

for (bool running = true; running; )
{
    int idx = UnixSignal.WaitAny(signals);

    if (idx < 0 || idx >= signals.Length) continue;

    log.Debug("daemon: received signal " + signals[idx].Signum.ToString());

    if ((intr.IsSet || term.IsSet)) 
    {
        intr.Reset ();
        term.Reset ();

        log.Debug("daemon: stopping...");

        running = false;
    }
    else if (hup.IsSet)
    {
        // Ignore. Could be used to reload configuration.
        hup.Reset();
    }
    else if (usr2.IsSet)
    {
        usr2.Reset();
        // do something
    }
}