I'm sure this is simple for many of you, but it's giving me
fits.
I receive cron-generated messages from approx 400 nodes each night,
and have been filtering them into a seperate cron folder. I'd
like to go a step further, and have a cron directory, with a folder
for each node sending the mail. I took a shot at a recipe, and it
is not working. Could someone please comment, and point out the
(probably obvious) errors?
Thanks.
#
# cron information handler...
#
: 0
* ^From root
* ^Subject: (O|o)utput from "cron" command
{
:0 h
FOLDER=| /usr/local/bin/formail -rt -xFrom: | awk -F@ '{print $2}' | awk -F.
'{print $1}'
:0 c
| echo "`/usr/local/bin/formail -x From:` (filed to cron - $FOLDER)" |
mail.sh -noise
: 0 :
_RootMail/_Crondir/$FOLDER
}
Notes:
I recognize that the formail/awk/awk line generates 3 subshells, and is
not efficient -- is there a better way to extract the nodename from this line?
The mail.sh program simply takes the input, puts a line on my console with
a timestamp followed by whatever was input to mail.sh, then "plays" a sound
based on the arg.
The _RootMail and _Crondir directorys exist, and are writable.
When this runs, this is an example from a VERBOSE log entry:
procmail: Match on "^From root"
procmail: Match on "^Subject: (O|o)utput from "cron" command"
procmail: Assigning "FOLDER="
procmail: Executing " /usr/local/bin/formail -rt -xFrom: | awk -F@ '{print $2}'
| awk -F.
'{print $1}'"
procmail: [14148] Fri Jan 5 08:12:11 1996
procmail: Assigning "LASTFOLDER= echo "`/usr/local/bin/formail -x From:` (filed
to cron -
$FOLDER)" | mail.sh -
noise"
procmail: [14148] Fri Jan 5 08:12:11 1996
procmail: Executing " echo "`/usr/local/bin/formail -x From:` (filed to cron -
$FOLDER)" |
mail.sh -noise"
procmail: Locking "_RootMail/_Crondir/.lock"
procmail: Assigning "LASTFOLDER=_RootMail/_Crondir//msg.FHT"
procmail: Opening "_RootMail/_Crondir//msg.FHT"
procmail: Acquiring kernel-lock
procmail: [14148] Fri Jan 5 08:12:12 1996
procmail: Unlocking "_RootMail/_Crondir/.lock"
From root Fri Jan 5 08:12:02 1996
Subject: Output from "cron" command
Folder: _RootMail/_Crondir//msg.FHT 420
procmail: Notified comsat:
"cpferron(_at_)0:/home/cpferron/.mail/_RootMail/_Crondir//msg.FHT"
procmail: Unlocking "/home/cpferron/.lockmail"
--
C. Paul Ferroni Phone: 216-646-4114 (voice) 216-646-3176 (fax)
Systems Specialist Admin areas: UNIX, WWW, Usenet News, etc, etc.
Allen-Bradley Company, Inc Email: Paul(_dot_)Ferroni(_at_)ab(_dot_)com