Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've been pulling my hair with this script:

#!/bin/bash
echo Content-type: text/html
echo ""
goaccess -f /var/www/log/access.log -a | tee

Which runs perfectly on the command line (generates HTML output for access.log), but when I run it as a CGI via the URL, the output isn't the HTML I'm expecting from GoAccess web analyzer but rather:

GoAccess - 0.7 

Usage: goaccess -f log_file [-c][-r][-m][-h][-q][-d][...]

The following options can also be supplied to the command: 
       -f - Path to input log file.
<snipped>

It is as if it's running goaccess without any parameters. Either that, or the parameters I specify in my Bash CGI aren't being seen for whatever reason.

I'm at the end of my wits. Any people w/some CGI experience that can help?

share|improve this question

1 Answer 1

Apparently, if you use -f to specify the log file a check is done to see if stdin is an interactive tty and if not, the program exists. From goaccess.c (line 792 for version 0.7):

if (conf.ifile != NULL && !isatty (STDIN_FILENO))
    cmd_help ();

Using cat to send the log file through a pipe does work, but I also needed to specify where a config file could be found:

cat /var/www/log/access.log | goaccess -p /home/brm/.goaccessrc -a
share|improve this answer
    
Thank you! Drove me nuts there for a while. –  Мартин Насковски Feb 14 at 22:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.