3

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 use mono-service2 to start it but it resulted in some error about image not found. It seemed to be talking about the mono image or some such and not a image file if that makes sense. It seems that the mono-service2 is built for dotnet 2.0 not dotnet 4.0 and i can't seem to find code for a dotnet 4.0 version. Can anyone point me in the correct direction or give me another way to run my services? I really want them to show up as a service in webmin so i can stop, start and check their status over the web.

I can't post the exact error as i don't have it on me but i will post it in about 6 hours if it will help.

Seer
  • 495
  • 5
  • 20
  • Just an update the error actually does not show anymore. Now it just returns right away but does nothing. Nothing is shown even with --debug flag and the log files for my app is not created or written to. – Seer Jul 28 '11 at 07:22
  • Also why do i get a -2 rating just for asking about mono-service2 and dotnet 4? – Seer Jul 28 '11 at 07:23
  • What version of mono have you got, and what linux distro? – IanNorton Jul 28 '11 at 18:05
  • ubuntu and mono 2.10 Also just to be clear the it runs fine as a console app on mono under linux it is just when i change it to a service and try to run it under mono-service2 that things don't seem to work. I thought maybe mono-service2 may not be built for 4.0 apps – Seer Jul 28 '11 at 20:32
  • http://stackoverflow.com/questions/3660039/success-with-start-stop-daemon-and-mono-service2 may be a way to do what i want and i plan to test it out and see how well i can get it to work. – Seer Jul 30 '11 at 01:54

2 Answers2

6

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.

David Moor
  • 76
  • 1
  • 3
  • Thank you! Been tearing my hair out over this, incidentally how did you find out where it maps to? – markmnl Mar 17 '14 at 02:08
0

If the program simply needs to run in the background rather than on a console there are other ways of starting it on linux without using the services system from mono.

Eg via a shell script:

#!/bin/bash
mono myprogram.exe $@ 1> ~/stdout.log 2> ~/stderr.log &
IanNorton
  • 7,145
  • 2
  • 25
  • 28
  • Sorry this is a process i want running all the time like a service even if i log out. I have looked at nohup but i still need to be able to shut it down cleanly like a service. For the console app i just have it wait for me to press enter but clearly that can't be done with nohup. well not that i know of anyway. As a service it did not matter as it has a shutdown method. – Seer Jul 28 '11 at 20:36
  • i have started looking at http://stackoverflow.com/questions/3660039/success-with-start-stop-daemon-and-mono-service2 as a possible solution – Seer Jul 30 '11 at 01:53