using mono-service to wrap a windows service on linux
Where is your LD_LIBRARY_PATH pointing to? Is libMonoPosixHelper.so
in there?
How to migrate a .NET Windows Service application to Linux using mono?
Under Linux, deamons are simple background processes. No special control methods (e.g start()
, stop()
) are used as in Windows. Build your service as a simple (console) application, and run it in the background. Use a tool like daemonize
to run a program as a Unix daemon, and remember to specify mono
as the program to be activated.
As noted by others, mono-service is a host to run services built with the ServiceProcess
assembly. Services built for Windows can use this method to run unmodified under Linux. You can control the service by sending signals to the process (see man page).
mono-service2 on linux for a Dotnet4 Service
I know this is 2 years late but I had the same problem.
Further investigation showed that 'mono-service2' (on my ArchLinux pc) maps to /usr/lib/mono/2.0 where as 'mono-service' maps to /usr/lib/mono/4.5
I hope this saves other people time.
Capture stack trace from crashed mono application run as a service in Linux via mono-service
Are you capturing unhandled exceptions in the application? Take a look at:
http://msdn.microsoft.com/en-us/library/system.appdomain.unhandledexception.aspx
This should allow you to at least log any unhandled exceptions so you can get a better idea what's happening.
How do I code a Mono Daemon
You should implement a service and use mono-service. Google for it and you'll find several examples.
Why doesn't a mono service restart after a kill -9?
When mono starts a service, it creates a lock in /tmp based on the program name or given parameter. You should stop the service by sending the SIGTERM not SIGKILL signal - if you did so, the lock would be deleted. Now you should manually delete the lock. Read details here.
How to start a service in C# on Linux
You can execute a command by doing this;
Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "/bin/bash";
proc.StartInfo.Arguments = "-c 'your command here'";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();
Related Topics
Why Is the Page Size of Linux (X86) 4 Kb, How Is That Calculated
Get Ceiling Integer from Number in Linux (Bash)
How to Compile/Install Node.Js(Could Not Configure a Cxx Compiler!) (Ubuntu)
Replacing Control Character in Sed
Pack Shared Libraries into the Elf
Secure Way to Run Other People Code (Sandbox) on My Server
Sending Udp Packets from the Linux Kernel
How to Get the Source Code for the Linux Utility Tail
Pthread Mutex Lock Unlock by Different Threads
Prevent Linux Thread from Being Interrupted by Scheduler
Self Modifying Code Always Segmentation Faults on Linux
How to Pass a Wildcard Parameter to a Bash File
Makefile That Distinguishes Between Windows and Unix-Like Systems
How to Run Nginx Within a Docker Container Without Halting
Can Docker Solve a Problem of Mismatched C Shared Libraries
What Are the Real Rules for Linux Usernames on Centos 6 and Rhel 6