file generation and mail notification


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting file generation and mail notification
# 1  
Old 08-25-2008
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 alwaysSmilie
Image
# 2  
Old 08-25-2008
Quote:
Originally Posted by anzie.sharma
I need help in writing a shell script that will automatically take output file from a particular folder from a server
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?

Quote:
and if the file is generated
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?

Quote:
send email notifications to certain group of ppl
Can you set up a mail alias or mail list? Then the script only needs to specify one recipient.

Quote:
and if it is not generated send a mail wid error msg..
# 3  
Old 08-25-2008
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...
# 4  
Old 08-25-2008
Okay, sounds simple enough. Put in /usr/local/bin/XXXX and associated files in /usr/local/lib/

Code:
#!/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:
Code:
From: ????
To: ????
Subject: The Oracle process ????

Hello, the oracle process ????

That's it, really, unless there's something I missed.
# 5  
Old 08-26-2008
thanks a ton..Smilie i think dat shud work.. thanks again Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script for sending notification mail

hi all, needed a script to send a notfication mail if the specified folder had the copy of the files that are older than 15 days i.ee for example my folder name is SAi and the files are as follows sai.txt copyofsai.txt copyofcopyofsai.txt hemanth.txt copyofcopyofhemanth.txt... (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies

2. Shell Programming and Scripting

AIX mail notification

plzzz help me, I want to send emails for exchange group members when the used file-system % gets more than 90%, this notification must include df -g, netstat -i,and errpt with the hostname thx in advance (0 Replies)
Discussion started by: majd_ece
0 Replies

3. Infrastructure Monitoring

Mail Notification in nagios

Hi guys, I have configured Nagios in My Ubuntu8.4 machine through Quickstart Guide, All things are working fine. Now i want to get Services Notification mails on my personal Email-id,what configuration is needed to get the mails,any assistance would be appreciable. Thanks in advance. (3 Replies)
Discussion started by: daya.pandit
3 Replies

4. UNIX for Dummies Questions & Answers

mail notification on file generation

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... (2 Replies)
Discussion started by: anzie.sharma
2 Replies

5. AIX

notification mail when password expired

Hallo, can anybody help me with my issue? Iīd like to know if it is possible to send me a mail (to @mail.com for example) when some account password will expired? eg. few days ago of this expiration. We donīt use this account every day, it is used for DB2 and DB2 has problem every 90īs day because... (2 Replies)
Discussion started by: JiriVenera
2 Replies
Login or Register to Ask a Question