Linux后台运行程序 nohup

nohup 全称:no hang up(不挂起)。也就是说,当前交互命令行退出的时候,程序还在运行。

nohup Command [Arg...] [ &]

nohup command > myout.file 2>&1 &
--------------
0 – stdin (standard input,标准输入) 
1 – stdout (standard output,标准输出)
2 – stderr (standard error,标准错误输出) 
2>&1解释:
将标准错误(2)重定向到标准输出(&1),
标准输出(&1)再被重定向输入到myout.file文件中。

nohup java -Xms1024m -Xmx2048m -jar -server xx.jar --spring.profiles.active=prod >nohup.log 2>&1 &