我正在运行两个脚本
# Script 1
nohup sh {command} &
并且 nohup.out 包含所有日志的详细信息(对于脚本 1)
# Script 2
nohup sh {command} > {log_path} 2>&1 &
但是 nohup.out 只有下面列出的有限日志(对于脚本 2),
## Script2 output
Shutdown message has been posted to the server.
Server shutdown may take a while - check logfiles for completion
如何在 nohup.out 本身中使用脚本 2 格式生成所有日志。
最佳答案
如果你想同时拥有这两个文件(nohup.out 和 {log_path}),你可以尝试:
((nohup {command}) > >(tee {log_path}) 2> >(tee {log_path}))>> nohup.out
命令行第一部分解释here .
在此之后,您只需将输出重定向(附加)到 nohup.out。
关于linux - nohup - 不打印所有日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44653961/