Cannot run mono

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 - ie run it as a daemon.

Currently the only way I know how to stop the service is to use the 'ps' command to get the mono process id number and then it using 'kill -9 ' to kill the process.

However doing so has the unfortunate conseqence that I am unable to start the service again? And, so far the only way I've managed to get it to start again is to first reboot.

I understand that the right way to go about this is to start the service like this instead:

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

With -l:MyService.lock creating a file holding the process id of the MyService.exe service so that I can kill that pid rather than the pid for mono.

However, when I do this the service does not start at all and no Myservice.Lock file is created. Adding sudo makes no difference, so I don't think it is a permission issue - but I don't know as my Linux skills are limited.

I'm using all the latest version of software and running this on a Raspberry Pi B+.

I'm stuck here. Any suggestions are very welcome. Thank you.

链接地址: http://www.djcxy.com/p/90034.html

上一篇: 服务在重启后停止

下一篇: 无法运行单声道