用于生成Go Access报告的Cron作业不起作用 [英] Cron job for generate Go Access report not working

查看:62
本文介绍了用于生成Go Access报告的Cron作业不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的根crontab中( sudo crontab -e ),我有这份工作来生成Go Access日志报告:

In my root crontab (sudo crontab -e) I have this job to generate Go Access log reports:

* * * * * goaccess /var/log/nginx/access.log -o /home/me/some/path/report.html

效果很好.我也有这份工作来生成跨越多天的报告:

It works just fine. I also have this job to generate a report that spans multiple days:

* * * * * sudo zcat -f /var/log/nginx/access.log* | goaccess -o /home/me/some/path/bigger_report.html

Cron说它可以运行,但实际上似乎没有运行.我环顾四周并尝试了很多事情(包括在此处关注列表- https://stackoverflow.com/a/22744360/3761310 ),但仍然无法运行此作业.如果我自己运行命令,它将按预期生成文件.我还尝试了管道之前的部分,将其输出到txt文件中,并且可以正常工作.因此,我怀疑这与Go Access有某种互动.

Cron says it runs but it doesn't actually seem to run. I've looked around and tried a bunch of things (including following the list here - https://stackoverflow.com/a/22744360/3761310) but still can't get this job to run. If I run the command myself it generates the file as expected. I also tried just the part before the pipe, outputting into a txt file and that worked. So I suspect it's some interaction with Go Access.

启用cron日志记录后,该作业运行时将显示以下内容:

When I enabled cron logging, this is what it says when that job runs:

(root) CMD (sudo zcat -f /var/log/nginx/access.log* | goaccess -o /home/me/some/path/bigger_report.html)

有指针吗?谢谢!

推荐答案

您需要让goaccess知道您正在使用-传递数据.例如,

You need to let goaccess know you are piping data using the -. e.g.,

* * * * * sudo zcat -f /var/log/nginx/access.log* | goaccess - -o /home/me/some/path/bigger_report.html

这篇关于用于生成Go Access报告的Cron作业不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆