Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unix 如何在守护进程模式下运行脚本而不受输出的影响?_Unix_Process_Logging_Daemon - Fatal编程技术网

Unix 如何在守护进程模式下运行脚本而不受输出的影响?

Unix 如何在守护进程模式下运行脚本而不受输出的影响?,unix,process,logging,daemon,Unix,Process,Logging,Daemon,我知道如何在守护程序模式下运行脚本(向其中添加(&a): mycmd-y config.yaml运行& 然而,我正在运行的脚本有很多“print”语句,这破坏了我的输出。有没有办法说“输出到log.txt” 这不起作用: mycmd -y config.yaml run& >> log.txt 嗯..我使用了nohup*command*>log.txt&另一种方法: mycmd-y config.yaml run>>log.txt 2>&1& 2>&1将stderr合并到s

我知道如何在守护程序模式下运行脚本(向其中添加(&a):

mycmd-y config.yaml运行&

然而,我正在运行的脚本有很多“print”语句,这破坏了我的输出。有没有办法说“输出到log.txt”

这不起作用:

mycmd -y config.yaml run& >> log.txt

嗯..

我使用了
nohup*command*>log.txt&
另一种方法:

mycmd-y config.yaml run>>log.txt 2>&1&

2>&1
stderr
合并到
stdout
中,以便所有内容都进入
log.txt