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.htmland 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/nullThe 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