简体   繁体   中英

Cron job for generate Go Access report not working

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 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.

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)

Any pointers? Thanks!

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM