file generation and mail notification

I'm very new to unix. I need help in writing a shell script that will automatically take output file from a particular folder from a server and if the file is generated send email notifications to certain group of ppl and if it is not generated send a mail wid error msg..
can any1 help me on that.. just a sample script wud also do..
Thanks as always:b:

First: Can you run scripts on that server? Can you email from that server? Have you tested this?

Second: Does this file always have the same name?

Third: How is the script started? From cron or from the command-line or from another process?

Fourth: Do you mean if the file exists? Is it possible the file can exist but be empty? If it is empty, does that mean generation failed?

Can you set up a mail alias or mail list? Then the script only needs to specify one recipient.

scripts can be run on the server. actually it is a log file created by program run on oracle apps. this log file is always generated if the program executes successfully or wud not b generated at all if it fails.. it wil hav different name( based on the parameters passed in oracle apps) but b stored in the same directory.
its run from command line n not cron..
email notification has 2 b sent 2 diff ppl based on organizations.. mailing list exists for this..
the problem here is entire process is automated.. the message body and the mailing list ( based on the output status) has 2 b decided at run time by the script itself...

Okay, sounds simple enough. Put in /usr/local/bin/XXXX and associated files in /usr/local/lib/

#!/bin/sh

LOGDIR=<path where logfiles are kept>
LOGFILE=<name of logfile>
SENDMAIL=/usr/sbin/sendmail
EMAIL_ON_SUCCEED=/usr/local/lib/email-success.txt
EMAIL_ON_FAIL=/usr/local/lib/email-fail.txt

if test -f "$LOGDIR/$LOGFILE" ; then
   cat $EMAIL_ON_SUCCEED | $SENDMAIL -t
else 
   cat $EMAIL_ON_FAIL | $SENDMAIL -t
fi

The Email files must be formatted as follows, where ???? is whatever makes sense for you:

From: ????
To: ????
Subject: The Oracle process ????

Hello, the oracle process ????

That's it, really, unless there's something I missed.

thanks a ton..:stuck_out_tongue: i think dat shud work.. thanks again :smiley: