[Mono-list] Re: mono-service

Bradley, Peter PBradley at uwic.ac.uk
Tue Nov 1 07:26:14 EST 2005


Robert,

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.

For example, the man page mentions that the assembly should have been
compiled with a reference to System.ServiceProcess, but it does not go
into any details:

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?  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?  What changes
(if any) are required to assemblies written as Windows services to make
sure they can run as daemons?

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.

As I said, I had not intended to post until I'd done some more work on
my own to try to answer those questions for myself, but I thought I'd
take advantage of Wilson's post to point up a perceived need for a
HowTo.  Please bear in mind that many of us come from a Windows
background (at least as far as application development is concerned) and
the kind of script you attached does not come naturally.  Many of us
simply don't know the requirements for daemons in Unix and Unix clones.
In fact, if the truth be known, we're often too busy meeting deadlines
to work out how Windows services work.  We just follow the instructions.
This may be deplorable :( but it is often true - and mea culpa.

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 :)

Thanks for your interest and readiness to help, and apologies again if I
appeared to be critical.  It wasn't my intention.  I'm too aware of my
own failings to look for failings in other people :)

Cheers


Peter

-----Original Message-----
From: Robert Jordan [mailto:robertj at gmx.net] 
Sent: 01 November 2005 11:44
To: Mono-list at lists.ximian.com
Subject: [Mono-list] Re: mono-service

Peter,

> Could I take the opportunity to add my voice to this?  I was intending
> to post something similar when I'd done a bit more work on the topic,
> but Wilson has beaten me to it.
> 
> The mono-service man pages are very sparse.  If I can get it working,
> I'd be very happy to write it up as a How-To sort of document for
> others.

Would you please elaborate? Which part of "man mono-service" is unclear
or sparse?

The only thing I can say about it: it doesn't mention that stdout
is redirected to /dev/null, but is how daemons have to behave on unix.
You can always use Console.Error.WriteLine ...

I'm attaching a init.d skeleton for mono-services, in the hope
that this (not quite mono related) problem will settle down
for a while.

It's for SUSE, but it can be easily adapted to other distros.

Robert



More information about the Mono-list mailing list