[Mono-list] mono service/SCM on linux how to

Nate Chadwick nate.chadwick at gmail.com
Mon May 1 16:50:20 EDT 2006


Thanks Zac.  I didn't even think of checking the man pages.  

-n 

-----Original Message-----
From: Zac Bowling [mailto:zac at zacbowling.com] 
Sent: Monday, May 01, 2006 4:31 PM
To: Nate Chadwick
Subject: Re: [Mono-list] mono service/SCM on linux how to

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]
servicename.exe

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'

to resume:

	$> kill -USR2 'cat /var/run/my-service-lock'

and then to kill say:

	$> kill 'cat /var/run/my-service-lock'


Zac


On Mon, 2006-05-01 at 14:51 -0400, Nate Chadwick wrote:
> Hi,
> 
> 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.
> 
> Thanks,
> 
> -n
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com 
> http://lists.ximian.com/mailman/listinfo/mono-list
> 



More information about the Mono-list mailing list