All pastes #388202 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-09 22:09 UTC
rendered paste body
#!/bin/sh

# Script designed to read daemontool logs.
# James McMillan 03/09/2007

# Change the following variables to the proper locations for your current logfile per service.
# Leave blank if you do not have the specific service.

# courier-authdaemond
CAUTHDLOG="/service/courier-authdaemond/log/main/current"
# courier-imap
CIMAPDLOG="/service/courier-imap/log/main/current"
# courier-imap-ssl
CIMAPDSSLLOG="/service/courier-imap-ssl/log/main/current"
# courier-passwd
CPASSWDLOG="/service/courier-passwd/log/main/current"
# qmail-send
QMAILSENDLOG="/service/qmail-send/log/main/current"
# qmail-smtp
QMAILSMTPLOG="/service/qmail-smtpd/log/main/current"
# qmail-pop3d
QMAILPOP3LOG="/service/qmail-pop3d/log/main/current"
# maildrop-logger
MAILDROPLOG="/service/maildrop-logger/log/main/current"
# tinydns
TINYDNSLOG="/service/tinydns/log/main/current"
# dnscache
DNSCACHELOG="/service/dnscache/log/main/current"


# Change this to the location of your tai64nlocal binary file
TAI="/usr/local/bin/tai64nlocal"

# This is a little sloppy, but it determines whether or not you want to follow the logfile
if [ $1 -e "-t" ]
then
        arg=$2
        TAIL="TRUE"
else
        arg=$1
fi

# Begin our case statement to determine the logfile to parse.
case "$arg" in
        authd)
        echo "Parsing Log $arg..."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $CAUTHDLOG | $TAI
        else
                $TAI < $CAUTHDLOG
        fi
        ;;

        imapd)
        echo "Parsing Log $arg..."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $CIMAPDLOG | $TAI
        else
                $TAI < $CIMAPDLOG
        fi
        ;;

        imapssl)
        echo "Parsing Log $arg..."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $CIMAPDSSLLOG | $TAI
        else
                $TAI < $CIMAPDSSLLOG
        fi
        ;;

        passwd)
        echo "Parsing Log $arg.."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $CPASSWDLOG | $TAI
        else
                $TAI < $CPASSWDLOG
        fi
        ;;

        qmail-send)
        echo "Parsing Log $arg..."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $QMAILSENDLOG | $TAI
        else
                $TAI < $QMAILSENDLOG
        fi
        ;;

        qmail-smtpd)
        echo "Parsing Log $arg..."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $QMAILSMTPLOG | $TAI
        else
                $TAI < $QMAILSMTPLOG
        fi
        ;;

        qmail-pop3d)
        echo "Parsing Log $arg..."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $QMAILPOP3LOG | $TAI
        else
                $TAI < $QMAILPOP3LOG
        fi
        ;;

        tinydns)
        echo "Parsing Log $arg..."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $TINYDNSLOG | $TAI
        else
                $TAI < $TINYDNSLOG
        fi
        ;;

        dnscache)
        echo "Parsing Log $arg..."
        if [ $TAIL = "TRUE" ]
        then
                tail -f $DNSCACHELOG | $TAI
        else
                $TAI < $DNSCACHELOG
        fi
        ;;

        *)
        echo "readlog [-t] argument
        echo "-t: will follow the logfile live  CTRL-C to exit
        echo "Arguements: authd|imapd|imapssl|passwd|qmail-send|qmail-smtpd|qmail-pop3d|tinydns|dnscache"

        ;;
esac

# Bye Bye
exit 0