问题描述
嗨,我正在尝试使用bash创建日志,但是我得到的时间是错误的。我正在后台运行。
# log code here before executing curl script log "Yay I was started"
curl https://example.com/process | sed "s/^/$(date -u) /" >> /path/to/logs.log &
处理curl后设置的时间是执行时间,而不是得到响应后的时间。我需要回复后的时间。
这是示例输出(错误的答复)
Fri Aug 21 01:43:12 UTC 2020 Yay I was started
Fri Aug 21 01:43:12 UTC 2020 Yay I was the response returned by the url
这里https://example.com/process
的网址休眠2秒钟,但是您看到的时间与执行它和得到响应之后的时间相同。
正确的响应
Fri Aug 21 01:43:12 UTC 2020 Yay I was started
Fri Aug 21 01:43:14 UTC 2020 Yay I was the response returned by the url
我该如何解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)