Cover V11, I07

Article
Listing 1
Listing 2

jul2002.tar

Listing 1 displayLog.cgi

1. #!/bin/sh
2. # displayLog.cgi
3. # Simple shell script to tail a Web server log file

4. # Get the formfield value from the QUERY_STRING variable
5. DATE="`echo $QUERY_STRING | sed -e s/Date=//`"
6. export DATE

7. if [ "$DATE" != "" ]; then
8.   DATE=$DATE
9. else
10.   # Default is today
11.   DATE="`date %Y%m%d`"
12. fi

13. LOGFILE="/var/log/httpd/httpd-$DATE.log"

14. # Set MIME type
15. echo "Content-type: text/plain"
16. echo

17. tail -25 $LOGFILE