[Mono-list] mono-service doesn't catch any signal

cometeor cometliao at gmail.com
Wed Mar 2 04:51:21 EST 2011


I'm using mono-2.8.2 on debian (virtual machine by openvz).
My test service:

class Test : ServiceBase
{
  static void Main()
  {
    ServiceBase.Run(new Test());
  } 

  static void Run()
  {
    while (!finished) {
    }
  }

  static bool finished = false;
  protected override void OnStart(string[] args)
  {
    Console.WriteLine("OnStart");
    Run();
  }

  protected override void OnStop()
  {
     Console.WriteLine("OnStop");
  }
  protected override void OnShutdown()
  {
     Console.WriteLine("OnShutdown");
  }
}

When I run 
$> mono-service --debug test.exe
OnStart() is called as expected. But when I execute
$> kill `cat /tmp/test.exe.lock`
The program terminates without printing anything, nor deleting the lockfile.
I've tried to add overriding OnPause, OnContinue, OnCustomCommand, ... but
no one was called.
Passing other signals such as USR1, USR2 as the example demostrated causes
the same result,
seems that the signals do not propagate to mono-service at all, just cause
the process terminates.
any ideas?

--
View this message in context: http://mono.1490590.n4.nabble.com/mono-service-doesn-t-catch-any-signal-tp3331259p3331259.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list