"Fossies" - the Fresh Open Source Software Archive

Member "squid-graph/generate.cgi" (2 Oct 2006, 1310 Bytes) of package /linux/privat/old/squid-graph-3.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 
    3 #####################################################################
    4 #
    5 # Example CGI script to launch Squid Graph to generate a report
    6 #
    7 # Supplementary tool for Squid Graph v3
    8 #
    9 # We *REALLY* do not recommend the use of this. It is provided
   10 # for the convinience of those who wants to use Squid Graph
   11 # as a CGI application
   12 #
   13 # Usage:
   14 #   http://www.some.server.com/generate.cgi?<password>
   15 #
   16 # Please refer to the Squid Graph v3 documentation for more info
   17 # http://squid-graph.sourceforge.net/
   18 #
   19 #####################################################################
   20 
   21 #
   22 # Set a password
   23 #
   24 PASS=nopass
   25 
   26 #
   27 # Where's your Squid logfile?
   28 #
   29 LOGFILE=/usr/local/squid/logs/access.log
   30 
   31 #
   32 # Output directory
   33 #
   34 OUTPUT_DIR=/tmp
   35 
   36 #
   37 # Other options (do NOT include --output-dir)
   38 #
   39 OPTIONS="--tcp-only --no-transfer-duration"
   40 
   41 #
   42 # Prefix -- where is Squid Graph installed?
   43 #
   44 PREFIX=/usr/local/squid-graph
   45 
   46 ### DO NOT TOUCH THIS ###
   47 
   48 echo "Content-type: text/plain"
   49 echo ""
   50 
   51 if test "$QUERY_STRING" = "$PASS"
   52 then
   53     if test ! -f $LOGFILE
   54     then
   55         echo "The file $LOGFILE does not exist!"
   56         exit
   57     elif test ! -d $OUTPUT_DIR
   58     then
   59         echo "The directory $OUTPUT_DIR does not exist!"
   60         exit
   61     else
   62         $PREFIX/bin/squid-graph -o=$OUTPUT_DIR $OPTIONS < $LOGFILE
   63         exit
   64     fi
   65 else
   66     echo "The password is incorrect!"
   67     exit
   68 fi