【发布时间】:2012-09-29 06:01:27
【问题描述】:
我有一个脚本可以确保进程继续运行,并且进程的输出被重定向到相应的 process_name.out 文件。
奇怪的是(至少对我而言),输出不会被重定向到文件,除非我关闭了脚本,尽管错误确实如此。
这方面的任何线索都会很有帮助。
#!/bin/bash
until $1 >> "/root/$1.out" 2>>"/root/$1.log" ; do
echo "Server $1 crashed with exit code $?. Respawning.." >> "/root/procees.log"
sleep 1
done
【问题讨论】:
-
你没有遭受表单缓冲的困扰吗?
-
试试
until unbuffer $1 ...祝你好运。 -
@shelter 谢谢,安装必要的软件包后它可以工作。
-
你能把它作为答案,shellter 或 w2lame 吗?目前,这被列为未回答的问题。
标签: bash outputstream fileoutputstream