Questions tagged [mono-service]

Execute Mono/.NET services built with the ServiceProcess assembly.

NAME

mono-service, mono-service2 - Mono ServiceProcess host

SYNOPSIS

mono-service [options] program.exe

DESCRIPTION

The mono-service is a host to run services built with the ServiceProcess assembly.

Use mono-service to run services that use the 1.0 assemblies and use mono-service2 to run services that use the 2.0 assemblies.

Services can be paused by sending the SIGUSR1 signal to the process, and execution can be resumed by sending the SIGUSR2 signal. The service can be cleanly shutdown by sending the SIGTERM signal to the process.

Mono programs started with mono-service run with the MONO_DISABLE_SHM variable set. This means that certain Mono features that depend on it are not available to services.

The following options can be used to control the service:

   -d:DIRECTORY
          Use this  option  to  specify  the  working  directory  for  the
          service.  The default is the current directory.

   -l:LOCKFILE
          Specifies the file to use for locking, the default is a filename
          constructed in /tmp based on the name of the program that  hosts
          the service.

   -m:MESSAGE
          Name to show in the syslog.

   -n:NAME
          Use  this  to specify the service to be launched (if the program
          contains more than one service).   The default  is  to  run  the
          first defined service.

   --debug
          Use  this  option to prevent mono-service from redirecting stdin
          and stdout and prevent the program to be sent to the background.
          Equivalent to --no-daemon

   --no-daemon
          Use  this  option to prevent mono-service from redirecting stdin
          and stdout and prevent the program to be sent to the background.
          Equivalent to --debug.

CONTROL

You can control the service by sending signals to the process, you can use the following commands:

  • Pausing service: cat <lock file> | xargs kill -USR1
  • Resuming service: cat <lock file> | xargs kill -USR2
  • Stopping the service: cat <lock file> | xargs kill

EXAMPLES

Start the MyService.exe assembly, with a lock in /root/service-lock:

mono-service -l:/root/service-lock MyService.exe

DEBUGGING

Messages produced by the service are logged on syslog.

MAILING LISTS

Visit http://lists.ximian.com/mailman/listinfo/mono-list for details.

WEB SITE

Visit: http://www.mono-project.com for details

Taken from Ubuntu manpages. Modified from original due to wiki restrictions

22 questions
52
votes
7 answers

How do I code a Mono Daemon

I'm trying to write a Mono C# daemon for linux. I'd like to do a starts and stops of it when its done processing instead of just killing the process. Does anyone have any examples of this? Edit: I figured out how to use start-stop-daemon…
Scott Cowan
  • 2,652
  • 7
  • 29
  • 45
13
votes
2 answers

using mono-service to wrap a windows service on linux

Hi I'm trying to use mono-service2 to run a stock Windows Service Project from visual studio. I'm running this on debian with mono 2.0 and compiling with. gmcs *.cs -pkg:dotnet I try and start with this (I've tried with -d set to the dir with the…
Scott Cowan
  • 2,652
  • 7
  • 29
  • 45
11
votes
1 answer

.NET Service to Linux Daemon

I am writing a portable service/daemon using .NET 3.5, my windows service is running, but I was wondering about the mono port... Mono-service is what I am looking for if I understand correctly. How exactly does this work though? I assume I need mono…
marked
  • 589
  • 9
  • 24
7
votes
2 answers

How to detect if I'm running in mono-service?

How can I detect I'm running under mono-service2? (in C#/.NET 3.5, running mono 2.6.7 on ubuntu 11) Type.GetType("Mono.Runtime") tells me I'm running in mono, so that part is ok. But Environment.UserInteractive is always false under mono it seems,…
BaBu
  • 1,923
  • 2
  • 16
  • 27
7
votes
1 answer

Testing Windows DOTNET Service on Linux using mono-service

I'm trying to run a Windows .NET-4.0 service on Linux using mono-service. It's not compiled with mono or anything. I'm not 100% it's doable but I thought I could try (binary compatible etc, seems doable?). Correct me if I'm wrong. I'm getting…
ejpb
  • 173
  • 2
  • 3
  • 9
5
votes
4 answers

Success with start-stop-daemon and mono-service2?

Has anyone had any success using start-stop-daemon and mono-service2 together? I've been fighting this for a few days now and have gotten various bits to work, but have had no success in getting a fully functional init script for a mono…
Typhoid
  • 51
  • 1
  • 1
  • 4
3
votes
1 answer

Passing command line arguments to mono-service

Is there a way to pass command line arguments to a service invoked by mono-service? All of the command line arguments seem to be absorbed by mono-service instead of passed to the service.
David Pfeffer
  • 38,869
  • 30
  • 127
  • 202
3
votes
2 answers

mono-service2 on linux for a Dotnet4 Service

Basically i have a dotnet 4 console application that i want to convert to a linux service. I have tested the console application on the latest build of mono and it works. I then converted the console application to a windows service and tried to…
Seer
  • 495
  • 5
  • 20
3
votes
1 answer

Capture stack trace from crashed mono application run as a service in Linux via mono-service

I'm running an application in Ubuntu that occasionally crashes. I'd like to capture the stack trace when the crash occurred. Is this possible? I'm launching my app like this: mono-service -m:logfile.out application.exe
sonofaforester
  • 337
  • 1
  • 10
2
votes
2 answers

mono-service2 does not create a lock file on OSX

I'm running OSX 10.9 with mono 3.2.4. I have a simple app I would like to run as a Daemon but mono-service does not create a lock file with the PID in it. I have tried searching in /tmp and also the temp path I get when…
RaVen
  • 775
  • 2
  • 8
  • 21
2
votes
1 answer

mono-service on windows

I have inherited an application that uses mono that runs a windows service. All of the original developers are gone. The production version uses mono on linux. I am trying to get a development environment up and running. I decided to use windows as…
larry
  • 21
  • 2
1
vote
0 answers

Cannot run mono-service -l:file.lock on Raspberry pi Debain Wheezy

I've written a service in C#. It runs fine on Windows as a service. And I can also get it to run once on Raspberry pi using the command: mono-service MyService.exe However, I would like to control the service - i.e. run it as a daemon. Currently…
1iveowl
  • 1,622
  • 1
  • 18
  • 31
1
vote
1 answer

Running mono-service with sgen garbage collector

OS: Ubuntu Is it possible to use mono-service with the sgen garbage collector? The normal garbage collector leaks all my memory until the end of the world comes. If I can't find a way to get sgen to work with mono-service I may just be stuck using a…
James
  • 680
  • 2
  • 8
  • 22
1
vote
1 answer

Using System.Diagnostics.EventLog in a C# daemon and mono-service

I've just managed to implement my first daemon using C# and mono (hurrah). It's working all fine except one thing. In windows for a service to log into system's log base, one should use System.Diagnostics.EventLog class. This class comes with a…
Mehran
  • 15,593
  • 27
  • 122
  • 221
1
vote
1 answer

Capture mono-service stdout console output?

Starting a service like this say: mono-service2 myservice.exe -l:/var/run/test How does one capture stdout? How does one capture the output if it crashes? Aside from the program logging itself, the output seems to be lost. syslog seems to only…
v2k
  • 1,083
  • 9
  • 13
1
2