简体   繁体   English

如何在后台运行单声道exe

[英]How to run exe in mono in the background

Okay, so I have a .net exe, and it runs when I type mono myexe.exe . 好的,所以我有一个.net exe,它在我键入mono myexe.exe时运行。 However, if I want to use another command or close the terminal window the app stops executing. 但是,如果我想使用其他命令或关闭终端窗口,应用程序将停止执行。

I have tried using mono myexe.exe & and it runs and showing [8] 20078 etc., but once I type something else it shows [8]+ Stopped, and then executes the command I typed in. 我已经尝试使用mono myexe.exe &它运行并显示[8] 20078等,但是一旦我键入其他内容它显示[8] + Stopped,然后执行我键入的命令。

Any ideas? 有任何想法吗?

怎么样nohup mono myexe.exe &

If you want to use & then look into outputting the result to a file. 如果要使用&然后查看将结果输出到文件。

nohup mono program.exe > program.out &

The right way of doing this would be to create a daemon with your linux distro. 这样做的正确方法是使用您的Linux发行版创建一个守护进程。

You can also run it as an service using this line of code: 您还可以使用以下代码行将其作为服务运行:

mono-service -l:/tmp/myservice.lock ./ServiceDaemon.exe

where -l:LOCKFILE specifies the file to use for locking. 其中-l:LOCKFILE指定用于锁定的文件。 When you look into your lock file, you will see the process id. 当您查看锁定文件时,您将看到进程ID。 The process id you can use to kill the service, whenever you need to terminate it. 无论何时需要终止服务,都可以使用进程ID来终止服务。

Source: blog.chudinov.net 资料来源: blog.chudinov.net

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM