#!/bin/sh # pppbiff - check for e-mail on remote server using fetchmail # # This script checks for mail on the imap/pop server using fetchmail, # but only when the ppp link is up. It's up to you to create the # proper .fetchmailrc to make this work. # # Eric Myers - 20 July 1998 # @(#) $Revision: 1.1 $ $Date: 1998/07/27 03:01:50 $ ###################################################################### # First verify that ppp0 is actually UP if [ "`ifconfig ppp0 2>/dev/null | grep UP`" = "" ]; then exit 0 fi # Try fetchmail to see if there is mail. If so, run it again # to get the count. if fetchmail -c -s ; then fetchmail -c else RC=$? if [ $RC -ne 1 ]; then echo -n "fbiff: fetchmail error ${RC}: " case "$RC" in 0) echo "OK." ;; 1) echo "No mail." ;; 2) echo "Pop error." ;; 3) echo "Authorization failure." ;; 4) echo "Protocol error." ;; 5) echo "Syntax error." ;; 6) echo "Permissions problem." ;; 7) echo "Server error." ;; 8) echo "Client exclusion error." ;; 9) echo "Lock busy." ;; 10) echo "SMTP failure." ;; *) echo "Unknown." ;; esac exit $RC fi fi