[Mono-list] c# written daemon, System.ServiceProcess, posix signals handling...

RoBiK robik@mailbox.sk
Fri, 16 Apr 2004 19:02:30 +0200


Hi Fawad,

Thank you for your answer. Even if I use runit, there is still the problem,
that I can't catch a signal inside the managed code. I have found also this
article
(http://lists.ximian.com/archives/public/mono-list/2003-March/012826.html),
but this guy has the same problem and no solution. Can you help me and show
me how should the code look like?

Thank you
Robert

-----Original Message-----
From: Fawad Halim [mailto:fawad@fawad.net] 
Sent: Freitag, 16. April 2004 16:26
To: mono-list@lists.ximian.com
Subject: Re: [Mono-list] c# written daemon, System.ServiceProcess, posix
signals handling...

Hi Robert,
    I'd suggest running your app under runit (http://smarden.org/runit/).
That'll take care of making sure the app is always running even when killed
abnormally. When you 'down' the service in runit, it sends it a SIGTERM and
maintains an internal flag that the service is supposed to be down
intentionally. There is a thread on signal handlers in the March '03 archive
of mono-list, including an example of a sigterm handler using unmanaged
calls.

-fawad

RoBiK wrote:

>Hi!
>
>I need to write an application in c#, wich should run in background and 
>be able to shut down gracefully when required.
>The best solution would be to use the System.ServiceProcess namespace, 
>but this namespace is not implemented in mono. I know that there were 
>some discussion about this topic in summer 2003, but since i found 
>nothing. Is there something new in this direction?
>The other way (not so nice, but would also do the job) would be the 
>catching of posix signals (SIGINT, SIGTERM...) but i have no idea how 
>to do thin in an mono application.
>The last solution is to use some selfmade communication mechnism, to 
>comunicate with the process and initiate the shutdow - maybe using 
>remoting or some simpler mechanism.
>Can someone give me some infos or ideas for the solution?
>
>Thanx
>
>Robert
>
_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list