美文网首页
linux 后台执行命令之nohup

linux 后台执行命令之nohup

作者: else05 | 来源:发表于2016-08-02 16:10 被阅读137次

如果直接在终端启动一个程序,那么终端关闭的时候,程序也会被终止,所以要使用nohup让程序后台执行

  • 基本
nohup java -jar xxx.jar > xxx.log 2 > &1 &

注:

其中 0、1、2分别代表如下含义:
0 – stdin (standard input)
1 – stdout (standard output)
2 – stderr (standard error)
nohup ./startWebLogic.sh >out.log 2>&1 &
nohup+最后面的& 是让命令在后台执行
out.log 是将信息输出到out.log日志中
2>&1 是将标准错误信息转变成标准输出,这样就可以将错误信息输出到out.log 日志里面来。

参考:

相关文章

网友评论

      本文标题:linux 后台执行命令之nohup

      本文链接:https://www.haomeiwen.com/subject/nhnfsttx.html