1. nohupthis
nohup 无疑是咱们首先想到的办法。顾名思义,nohup 的用途就是让提交的命令忽略 hangup 信号。让咱们先来看一下 nohup 的帮助信息:spa
NOHUP(1) User Commands NOHUP(1) NAME nohup - run a command immune to hangups, with output to a non-tty SYNOPSIS nohup COMMAND [ARG]... nohup OPTION DESCRIPTION Run COMMAND, ignoring hangup signals. --help display this help and exit --version output version information and exit
可见,nohup 的使用是十分方便的,只需在要处理的命令前加上 nohup 便可,标准输出和标准错误缺省会被重定向到 nohup.out 文件中。通常咱们可在结尾加上"&"来将命令同时放入后台运行,也可用">filename 2>&1"
来更改缺省的重定向文件名。code
接着可使用mono 直接执行。orm
nohup mono Server.exe >log.out 2>&1 &
或者
setsid mono Server.exe
若是须要中止后台进程首先执行blog
ps -aux
找到相应的进程id,接着直接kill掉进程
kill 17969
[root@pvcent107 ~]# screen -dmS Urumchi [root@pvcent107 ~]# screen -list There is a screen on: 12842.Urumchi (Detached) 1 Socket in /tmp/screens/S-root. [root@pvcent107 ~]# screen -r Urumchi