Inhalt

13. Nützliche Hilfsprogramme

13.1 Was ist heute schon passiert (Shellprogramm)?

Ich habe mir ein kleines Programm geschrieben, daß mir anzeigt, was heute schon im Zusammenhang mit UUCP passiert ist. Das Programm durchsucht die Datei /var/spool/uucp/Log und »grept« alles raus, was heute passiert ist ;-).

uucpstatus.sh:

#!/bin/sh
/bin/cat /var/spool/uucp/Log | \
   /usr/bin/grep `date '+%Y-%m-%d'` | \
   grep -e  "Call complete" -e "Receiving rmail" \
        -e "Login successful" -e "Queuing" \
        -e "Handshake" -e "Error" -e "ERROR" -e "Protocol"

Beispielausgabe:

uux tpki root (1998-06-17 10:06:29.49 360) Queuing rnews (D.00IK)
uucico tpki - (1998-06-17 10:06:35.68 362) ERROR: Chat script failed: Got "BUSY"
uucico tpki - (1998-06-17 10:06:52.05 363) Login successful
uucico tpki - (1998-06-17 10:06:52.71 363) Handshake successful (protocol 'i' sending packet/window 1024/16 receiving 2048/7)
uucico tpki mail (1998-06-17 10:06:54.41 363) Receiving rmail newsadmin (552 bytes)
uucico tpki news (1998-06-17 10:06:54.86 363) Receiving rmail news (3395 bytes)
uucico tpki mail (1998-06-17 10:06:55.30 363) Receiving rmail newsadmin (3512 bytes)
uucico tpki uucp (1998-06-17 10:06:55.59 363) Receiving rmail ttt (1085 bytes)
uucico tpki uucp (1998-06-17 10:06:56.04 363) Receiving rmail newsadmin (1459 bytes)
uucico tpki uucp (1998-06-17 10:06:56.24 363) Receiving rmail newsadmin (1390 bytes)
uucico tpki uucp (1998-06-17 10:06:56.66 363) Receiving rmail newsadmin (2431 bytes)
uucico tpki uucp (1998-06-17 10:06:57.25 363) Receiving rmail ttt (1676 bytes)
uucico tpki uucp (1998-06-17 10:06:57.38 363) Receiving rmail ttt (1318 bytes)
uucico tpki mail (1998-06-17 10:06:57.72 363) Receiving rmail newsadmin (661 bytes)
uucico tpki mail (1998-06-17 10:06:57.76 363) Receiving rmail newsadmin (552 bytes)
uucico tpki mail (1998-06-17 10:06:58.31 363) Receiving rmail newsadmin (19672 bytes)
uucico tpki mail (1998-06-17 10:07:00.60 363) Receiving rmail newsadmin (683 bytes)
uucico tpki mail (1998-06-17 10:08:31.13 363) Receiving rmail newsadmin (1084 bytes)
uucico tpki - (1998-06-17 10:08:31.32 363) Protocol 'i' packets: sent 91, resent 0, received 452
uucico tpki - (1998-06-17 10:08:31.46 363) Call complete (101 seconds 720823 bytes 7136 bps)
uux tpki hscholz (1998-06-17 10:08:56.93 433) Queuing rmail zoc@toppoint.de (D.00IL)
uux tpki news (1998-06-17 11:00:06.93 665) Queuing rnews (D.00IM)
uux tpki hscholz (1998-06-17 11:47:22.71 1142) Queuing rmail lars.fruehsorge@ploe.comcity.de (D.00IN)
uux tpki news (1998-06-17 13:00:03.44 8136) Queuing rnews (D.00IO)

13.2 Was ist heute schon passiert (CGI-Skript für WWW-Server)?

Das gleiche, was per Shell möglich ist, kann man natürlich auch als HTML-Seite auf dem eigenen WWW-Server anzeigen lassen. Es müssen dafür nur die Standard-HTML-Header um die Seite herumgebaut werden.

uucpstatus.cgi:

#!/bin/sh
echo "Content-type: text/html"
echo
echo
echo "<html><head><title>UUCP-Statistik</title></head>"
echo "<body bgcolor=\"#FFFFFF\"><pre>"
/bin/cat /var/spool/uucp/Log | \
  /usr/bin/grep `date '+%Y-%m-%d'` | \
  grep -e  "Call complete" -e "Receiving rmail" \
    -e "Login successful" -e "Queuing" -e "Handshake" \
    -e "Error" -e "ERROR" -e "Protocol"
echo "</pre></body></html>"

Die Ausgabe sieht aus wie im Shell, mit dem Unterschied, daß es eine HTML-Datei ist.


Inhalt