Bourne Shell 中的刷新输出
我在 Upstart 脚本中使用 echo 来记录事情:
script
echo "main: some data" >> log
end script
post-start script
echo "post-start: another data" >> log
end script
现在这两个并行运行,所以在日志中我经常看到:
main: post-start: some data another data
这并不重要,所以我不会采用适当的同步,但我想我会将自动刷新打开到 at至少减少这种影响。 有没有简单的方法可以做到这一点?
更新:是的,冲洗不能正确修复它,但我已经看到它在某种程度上有助于这种情况,这就是我在这种情况下所需要的。 只是不知道如何在Shell中实现
I use echo in Upstart scripts to log things:
script
echo "main: some data" >> log
end script
post-start script
echo "post-start: another data" >> log
end script
Now these two run in parallel, so in the logs I often see:
main: post-start: some data another data
This is not critical, so I won't employ proper synching, but thought I'd turn auto flush ON to at least reduce this effect. Is there an easy way to do that?
Update: yes, flushing will not properly fix it, but I've seen it help such situations to some degree, and this is all I need in this case. It's just that I don't know how to do it in Shell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(3)
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
尝试更改:
至:
Try changing:
To: