[Mono-list] mono service/SCM on linux how to
zac at zacbowling.com
Mon May 1 16:33:24 EDT 2006
There is a service wrapper for the ServiceProcess class. Since all
init.d the implements (or start-stop-pause daemons) have different
flavors and variations in each distro, you will have to write the
wrapper for your init.d yourself.
You can find the source in the mcs source under mcs/tools/mono-service/
and you should have a program installed script installed with mono
called 'mono-service'. You can also read the man page on it as well.
The way it works is you write an sh script (or whatever you start/stop
daemon uses) and have it invoke that app using these parameters:
mono-service [-d:DIRECTORY] [-l:LOCKFILE] [-n:NAME] [-m:LOGNAME]
The way it works is if you want to Stop the service, you pass in a
SIGTERM kill command, if you want pause you kill with SIGUSR1, and to
resume you call SIGUSR2.
An example would be to start the service run:
$> mono-service -l:/var/run/my-service-lock MyService.exe
then to pause:
$> kill -USR1 ‘cat /var/run/my-service-lock‘
$> kill -USR2 ‘cat /var/run/my-service-lock‘
and then to kill say:
$> kill ‘cat /var/run/my-service-lock‘
On Mon, 2006-05-01 at 14:51 -0400, Nate Chadwick wrote:
> I have been trawling the list archives and the mono site on the
> recommended approach for writing / deploying a windows service to
> target linux but haven't been able to find a good reference.
> What is the current recommended approach for developing and deploying
> services with mono on linux?
> Basically I am looking to port a windows service so that it runs via
> /etc/init.d/natesnuclearservice start | stop | restart etc.
> I saw a few threads refer to a mono-service but they seemed a couple years old?
> Any pointers appreciated.
> Mono-list maillist - Mono-list at lists.ximian.com
More information about the Mono-list