Hi, since $EMAILMESSAGE is a variable and not a file you can not use input redirection like that. Also it is typically good practice to quote variable references..
You could try:
or better yet:
Which would protect against awkward characters in the email message body.
Is $RECIPIENT set to a valid email address?
Hey Scrutinizer,
You seem to live up to your display id.I have made the changes accordingly. And yes the e-mail id is set to a valid id. I recieved the mail with all the the messages that contain error or warning.
I will put up the updated code separately.
Could you also give me a hint on how i could do the tasks of script. The main task is to scan the log file for new entries. I am not able to figure out how to scan the log file for the first time and then when the script is run the 2nd time, it needs to scan only new entries and ignore previous entries.
My approach was to create a tmp_log file of the log that is being scanned and then read from there. But i then realized if a different log file is scanned every time then my approach would fail. What is your opinion? Could you please give a logic and possible commands to use.
I might consider using wc for counting line numbers and then compare the logfile given asn argument with tmp_log that the script creates. then find the difference of the lines and print that in a second tmp_log file and do operations on that.
Again, Thanks for you valuable feebacks.
---------- Post updated at 11:08 PM ---------- Previous update was at 10:52 PM ----------
New improvements in the script are:
This script now searches for string mentioned searched using egrep.
Stores output of egrep in a variable and is passed to the email message variable.
It successfully sends an email with the entries of the specified log file that matched the string pattern in egrep
The code is below. I have tried to highlight all the recent updates that were made:
The output of the script now is as below:
Last edited by vin8465; 06-01-2010 at 10:13 AM..
Reason: Added output of script
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
I am stuck and worried. My assignment was due a day ago and I was too busy completing other assignments due during the same time. I worry that not completing this assignment... (1 Reply)
i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail.
actually i am trying to automate the high... (2 Replies)
This is my log file and this is live log.
Any abnormal error other than following
I need to generate the email.
Log path : /DER/app/admin/ABC/bdump/erg.log
Current log# 2 seq# 103046 mem# 0: /ora2/oradata/ABC/redo02a.log
Current log# 2 seq# 103046 mem# 1:... (1 Reply)
This is my log file and this is live log.
Any abnormal error other than following
I need to generate the email.
Log path : /DER/app/admin/ABC/bdump/erg.log
Current log# 2 seq# 103046 mem# 0: /ora2/oradata/ABC/redo02a.log
Current log# 2 seq# 103046 mem# 1:... (7 Replies)
Hi All
Need help
Can any one share a basic script that is used for monitor sendmail service whether online, offline.etc in solaris
Thanks in advance
Zimmy (5 Replies)
Hi
I want to monitor a file even if the file rotate. When a text occurs I want to send a mail.
Something like this but it's not working correctly:
tail -F mylog.log | grep 'MatchMe' |
while read line
do
echo $(date +"%Y-%m-%d %H:%M:%S") MatchMe occurs | mail -s "MatchMe"... (1 Reply)
Hello,
I wanted to search specific string in the acitve log file and send an email if the search string found in the log.
Log file is written by application all the time. So, script has to search if any new log entry has the specific string for example " sample exception" and send an email. (1 Reply)
I want to monitor the maillog file in real time and send a mail when a certain grep condition is met. Every time the grep condition is met a mail will be sent. I wish to ignore all grep conditions 30 mins after each mail and thereafter continue monitoring.
For example:
Condition is met, mail... (1 Reply)
I am having trouble getting mail to work on a red hat server. At first I was getting this message.
Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused
Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)