[Mono-list] Re: mono-service

Jörg Rosenkranz joergr at voelcker.com
Tue Nov 1 07:51:43 EST 2005


Hi Peter,

> -----Original Message-----
> From: mono-list-bounces at lists.ximian.com 
> [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of 
> Bradley, Peter
> Sent: Tuesday, November 01, 2005 1:26 PM
> 
> My post was not intended as a criticism of the man page, and I'm very
> sorry if it appeared to be so.  Perhaps I should have been 
> clearer, but
> what I was really saying that what (I think) is needed is a HowTo.

Yes I think this is true. There needs to be something in the Wiki.

To answer some of your questions:

> Does the process to be run as a daemon have to inherit from
> System.ServiceProcess.ServiceBase?  Does it guarantee that the
> OnStart(), OnStop(), OnPause(), and OnContinue() methods get called as
> appropriate?  

The service has to be implemented according to the MS docs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemserviceprocessservicebaseclasstopic.asp
and
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemserviceprocessservicebaseclassruntopic1.asp

Short: It needs to be inherited from ServiceBase and it needs to call 
ServiceBase.Run in it's Main method.

> What does one have to do make the service start 
> up at boot
> time and run without a user logged in?  (Your script is a 
> great help in
> that regard.  Thanks).  What user does the service run as?  

It runs as the user you are starting mono-service with. You
are responsible for switching the user in the start script.
Examples of start scripts should be in the Wiki/Doc/etc. too.
Maybe that's tootoo distribution specific to put it into SVN?

> What changes
> (if any) are required to assemblies written as Windows 
> services to make
> sure they can run as daemons?

There are no changes needed if the assemblies are written
with the normal portability rules in mind. Mono-service 
should mimic the behaviour of MS' implementation as close 
as possible.

> The OP obviously has trouble getting the OnStart() method 
> running.  The
> reason why might be contained in the answers to the questions I make
> above.

Yes :-)

> I'm perfectly happy to put my money where my mouth is as far as
> producing a HowTo is concerned.  Once I've got a daemon 
> running, I'll be
> only too happy to explain how it was done.  But I may need my hand
> holding a little in the meantime :)

The man page is very basic and contains only information about 
handling of services. There should be an article about implementation
of services too. I would be happy if you write a howto down.
Please ask if you have any questions.

Joerg.


More information about the Mono-list mailing list