用途:使运行的程序忽略SIGHUP。
语法:nohup Command [ Arg ... ] [ & ]描述:nohup 命令运行由 Command 参数和任何相关的 Arg 参数指定的命令,忽略所有挂断(SIGHUP)信号。在注销后使用 nohup 命令运行后台中的程序。要运行后台中的 nohup 命令,添加 & ( 表示“and”的符号)到命令的尾部。
那么如果需要重定向该怎么办?
nohup ./start-dishi.sh > FILE & 即可
nohup的man文档中说明了:
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’ 重定向到自定义文件。
转载于:https://www.cnblogs.com/andrew-chen/p/11549272.html