您的位置:首页 > 编程语言 > Go语言

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

2016-08-03 00:00 309 查看
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.

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

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 with

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 to

cat /var/log/nginx/access.log | goaccess -a > output.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  goaccess nginx