Linux命令之nohup 和 重定向

用途:使运行的程序忽略SIGHUP。app

语法:nohup Command [ Arg ... ] [ & ]
描述:nohup 命令运行由 Command 参数和任何相关的 Arg 参数指定的命令,忽略全部挂断(SIGHUP)信号。在注销后使用 nohup 命令运行后台中的程序。要运行后台中的 nohup 命令,添加 & ( 表示“and”的符号)到命令的尾部。文档

那么若是须要重定向该怎么办?terminal

nohup ./start-dishi.sh > FILE  & 便可input

nohup的man文档中说明了:it

  • If standard input is a terminal, redirect it from an unreadable file.
  • If standard output is a terminal, append output to 'nohup.out' if possible, '$HOME/nohup.out' otherwise.
  • If standard error is a terminal, redirect it to standard output.
  • To save output to FILE, use 'nohup COMMAND > FILE'.

就是说 默认会把标准错误 重定向到标准输出。标准输出默认是 nohup.out, 能够加上‘ > FILE’ 重定向到自定义文件。后台

相关文章
相关标签/搜索