ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I intend to create a syslog errors monitoring script where it does:
1. capture all error messages
2. running every 5 minutes
3. It won't go to line number 1 or repeating line.
Hi All,
I intend to create a syslog errors monitoring script where it does:
1. capture all error messages
2. running every 5 minutes
3. It won't go to line number 1 or repeating line.
Any clue or help must appreciate
Install and configure logwatch...that's what it does, and it's already written, and probably in your online repositories.
Thanks you for your reply.
Our server are majority is hpux therefore I would like to create a script.
Actually I have created one but I'm not so sure how to make second second does not coming back to line 1.
If you really want to go for a bash solution, something like this might work:
Code:
#/bin/bash
tail -F /var/log/messages|while read LINE;do
case line in
"Error1")
mail command to send $LINE to whatever ;;
"Error2")
mail command to send $LINE to whatever ;;
"Error3")
mail command to send $LINE to whatever ;;
esac
done
Modify as needed. This reads new lines going in to whatever log file you specify, and searches them for patterns.
Yes...install logwatch on HPUX. Download the source, and install it. All you'll be doing is re-inventing the wheel.
I agree.
More importantly spidertux1, you're simply not able to capture and anticipate all warnings and errors with your simple script. So if you're going to script it yourself anyway you make yourself responsible for any missed warnings you could have acted on if only you would have run the right tool.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.