Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

parsing through messages for errors

Original Message
Name: sohk220
Date: April 24, 2007 at 12:52:11 Pacific
Subject: parsing through messages for errors
OS: Unix/Solaris
CPU/Ram: 2GB
Model/Manufacturer: Sun Blade 150
Comment:
Greetings everyone... I have an issue with a parsing script. My script is parsing through the messages file for "Warning|Panic|Error" messages. I wrote a simple script below.

#!/usr/bin/csh

egrep "WARNING|ERROR|PANIC" /var/adm/messages* > /tmp/test
cat /tmp/test | mailx -s "warning" username1 username2

How can I get the script to parse daily within a twelve hour period such as 8am to 8pm and so on for daily parse of that day only... hope someone can help me.... not really a scripting guys... just a beginner.. sorry...and hope someone can help me out


Report Offensive Message For Removal


Response Number 1
Name: ghostdog
Date: April 24, 2007 at 16:53:02 Pacific
Subject: parsing through messages for errors
Reply: (edit)
put it on a cron job.

Report Offensive Follow Up For Removal

Response Number 2
Name: sohk220
Date: April 25, 2007 at 05:47:56 Pacific
Subject: parsing through messages for errors
Reply: (edit)
Ghostdog,

Thanks for the comment... I will try this out. Will this parse the messages for the day only? or will it parse through the entire log from previous days?

Thanks


Report Offensive Follow Up For Removal

Response Number 3
Name: ghostdog
Date: April 25, 2007 at 07:36:16 Pacific
Subject: parsing through messages for errors
Reply: (edit)
cron job is like the windows task scheduler. uu just set the date and time you want to run your script. check the man page for cron / crontab for more information

Report Offensive Follow Up For Removal

Response Number 4
Name: sohk220
Date: April 25, 2007 at 07:50:45 Pacific
Subject: parsing through messages for errors
Reply: (edit)
Thanks, I placed it in the cron and will see how it works... thanks for the help.

Report Offensive Follow Up For Removal

Response Number 5
Name: sohk220
Date: April 25, 2007 at 11:39:24 Pacific
Subject: parsing through messages for errors
Reply: (edit)
Well, no when I do that it mails me the entire log file that contains the variables "WARNING|ERROR|PANIC" that are old. I need something more to run every 15 minutes and begin again at the last line that is parsed through. That way if something is found, it will then email me.

Report Offensive Follow Up For Removal


Response Number 6
Name: nails
Date: April 25, 2007 at 14:47:56 Pacific
Subject: parsing through messages for errors
Reply: (edit)
Cron alone won't do this for you. You are going to have to write a script that saves the last line processed to a file, and then start at that point the next time the script starts.

Check out this link:

http://www.unixreview.com/documents...

The author of this article is processing an Oracle alert file. You might be able to modify it to fit your needs.


Report Offensive Follow Up For Removal

Response Number 7
Name: sohk220
Date: April 26, 2007 at 07:36:46 Pacific
Subject: parsing through messages for errors
Reply: (edit)
Thanks nails, I will give it a try.

Report Offensive Follow Up For Removal

Response Number 8
Name: sohk220
Date: April 26, 2007 at 13:06:51 Pacific
Subject: parsing through messages for errors
Reply: (edit)
nails, that script was very helpful.. just working the querks now...

Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: parsing through messages for errors

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




DSHUB24 Connection Problems

need help with dsl and dial up

novel 3.12

help mandriva install last straw!

Icon Scaling in Explorer Bar


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC