goaccess在定时任务中不执行的问题

When a task is run within cron, stdin is closed. Programs that act differently based on whether stdin is available or not will behave differently between the shell session and in cron.html

An example is the program goaccess for analysing web server log files. This does NOT work in cron:nginx

goaccess -a -f /var/log/nginx/access.log > output.html

and goaccess shows the help page instead of creating the report. In the shell this can be reproduced withweb

goaccess -a -f /var/log/nginx/access.log > output.html < /dev/null

The fix for goaccess is to make it read the log from stdin instead of reading from the file, so the solution is to change the crontab entry toshell

cat /var/log/nginx/access.log | goaccess -a > output.html
相关文章
相关标签/搜索