#! /bin/sh LOCKFILE=~/fetchit.$USER.lock FETCHMAILRC= if [ "$1" = "others" ]; then FETCHMAILRC="--fetchmailrc /home/dickson/.fetchmailrc2" fi if [ -f $LOCKFILE ]; then exit fi >~/fetch.errors echo `date` >>~/fetch.log fetchmail $FETCHMAILRC --all --expunge 50 -L ~/fetch-log 2>&1 \ | tee ~/fetch.errors \ | grep -E ".*message.*for " \ | sed -n -e 's/\(fetchmail: \)\([0-9]\+ messages*\)\( for \)\(.*\)\( at \)\(.*\)\( \)\((.*)\)\./\4(_at_)\6: \2 \8/p' >>~/fetch.log if [ -f $LOCKFILE ]; then rm $LOCKFILE fi