[Mono-list] Re: Long-running services

Jörg Rosenkranz joerg.rosenkranz at gmail.com
Mon Jan 23 08:17:40 EST 2006


I have attached a little sample service you can use as template for
your own tests.
It only writes a log file for all actions.

It can be compiled using:
mcs -out:TestService.exe -r:System.ServiceProcess.dll
-r:System.Configuration.Install.dll  TestService.cs

If you don't need the Windows install functionality you can safely remove
the ProjectInstaller class and the reference to

Run it using;
mono-service TestService.exe

For more parameters see man mono-service

Controlling the service is easy:

Pausing: kill -USR1 `cat /tmp/TestService.exe.lock`
Continueing: kill -USR2 `cat /tmp/TestService.exe.lock`
Ending: kill `cat /tmp/TestService.exe.lock`

Have a look at the log to see any consequences of your actions because
there will be no feedback on the command line :-)
Errors go to syslog.


2006/1/23, Oleg Deribas <oleg at td.kharkov.ukrtel.net>:
> Hello,
> Mario Munda said the following on 23.01.2006 11:17:
> > I have to write an application running under FreeBSD, and I choose Mono,
> > because it is simple.. This app does not need GUI, and it has to run as
> > a deamon.
> > I know how to design and develop app, but i don't know how to set it to
> > run as a deamon.
> Use System.ServiceProcess namespace and mono-service to run it as daemon
> (man mono-service). I'm not sure if it have any differences on FreeBSD,
> but I've tested it on linux and it works as expected.
> --
> Oleg
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestService.cs
Type: text/x-csharp
Size: 4395 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20060123/20f4d665/TestService.bin

More information about the Mono-list mailing list