我如何编写一个单声道守护 [英] How do I code a Mono Daemon
问题描述
我试着写Linux的单C#守护进程。
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.
有没有人有任何的例子
编辑:我想出如何使用。启停守护--background在Debian中,所以我想我就用,就目前
I figured out how to use start-stop-daemon --background in debian, so I think I'll just use that for now.
编辑:我在Java以及实施这一点,他们有这个漂亮的addShutdownHook映入终止应用程序。我需要多花一点时间,单服务整理出相关性,或者找到一个办法赶上应用终端。
I'm implementing this in java as well and they have this nice addShutdownHook that catches terminating the app. I need to spend a little more time sorting out the dependencies for mono service, or find a way to catch app termination.
有是SESSIONEND事件,但多数民众赞成只适用于服务,而不是控制台应用程序
There is the SessionEnd event, but thats only available for services and not console apps
推荐答案
您应该实现服务和使用单服务。谷歌为它,你会发现几个例子。
You should implement a service and use mono-service. Google for it and you'll find several examples.
这篇关于我如何编写一个单声道守护的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!