Sponsored Content
Top Forums Shell Programming and Scripting script to grep only the lasts errors Post 302528405 by jblecrou on Tuesday 7th of June 2011 05:23:19 AM
Old 06-07-2011
script to grep only the lasts errors

Hi,

sorry if there already a thread about this, I did a little bit of digging but haven't found exactly what I want.
I have a java application on a glassfish server who crash from time to time Smilie

I need a script to allert me if there's a error like "java heappspace" or "out of memory" in the server.log

for now I've done that :
Code:
#!/bin/sh
DIR=/opt/appli/glassfish.prod/domains/domain1/logs
MAIL=/usr/ucb/mail
DEST_MAIL=mail@me.com
SUBJ_MAIL="alert java  heapspace blablabla"
/usr/xpg4/bin/grep -q 'Java heap space'  $DIR/server.log
if [ $? -eq 0 ]
    then echo "alerte java heapspace was found" | $MAIL -s "$SUBJ_MAIL" $DEST_MAIL
fi

it works fine but the thing is, the log roll is every 10Mo and I don't want to change that, and the script will continue to allerte me even if the error was taking care of (until the server.log is archive and a new one is created)

So I need to find a way to grep this type of error, but to detect if this error has already bin found
I really don't know how to start....if there's any idea?

I'm on a Soalris 10

thanks

Last edited by Franklin52; 06-07-2011 at 06:35 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

errors using grep

heres the line i think is giving me the error. any help is appreciated. code: if or posibly; while || error : usage: grep -e pattern_list... usage: grep -f... (2 Replies)
Discussion started by: pbonilla
2 Replies

2. Shell Programming and Scripting

Remove lasts characters from a string

Hi all, Consider i have a directory /tmp/test and inside this directory i have the following files: 1.svf.tmp 2.svf.tmp 3.svf.tmp How can i remove the last four characters of every file in irder for the directory to be as: 1.svf 2.svf 3.svf I use the following command but id doesn't... (6 Replies)
Discussion started by: chriss_58
6 Replies

3. Shell Programming and Scripting

Script to capture errors

Hello; I'm trying to write a script to capture any hardware error from logs/syslog on my SUSE 10 servers so i can be notified if we have any hardware issues such a bad fan or battery, etc.. Thanks in advance for any help (2 Replies)
Discussion started by: Katkota
2 Replies

4. Shell Programming and Scripting

Help with shell script errors

hey watsup guys i am new in the shell script world. so i need help fom you guys, i have written these two codes and they both give the same errors( expr : syntax error). Code 1 : #! /bin/sh # count1 appends an increment to a file 200 times # note that a file called numbers must be... (5 Replies)
Discussion started by: surubi_abada
5 Replies

5. Shell Programming and Scripting

ftp script : list 4 lasts files

Hi, At work we have backups on a ftp. I want to view 4 last files saved (their names, dates, and weight). how can i achieve this goal using simplest way ? Thank's. (3 Replies)
Discussion started by: simon974
3 Replies

6. Shell Programming and Scripting

purge logs, keep the 30 lasts

Hi, I have to make a script to purge logs in a directory (this script will run automatically every day) and this script has to keep just the 30 last files. So I want it to count all the files in the directory, find the 30 most recents and delete the others. I just started shell scripting and... (4 Replies)
Discussion started by: jblecrou
4 Replies

7. Shell Programming and Scripting

Help with execution errors in script

solution found.... Please use tags for scripts, listings, and console output (2 Replies)
Discussion started by: audiolord
2 Replies

8. UNIX for Dummies Questions & Answers

How to ignore errors in script

I have a simple script that processes files. Here's a simplified example of what I'm doing: foreach t (web.*) mv $t dnw$t:e.log end foreach t (card.*) mv $t card$t:e.log end The problem is that sometimes there is no web.* file. In that case, I get an error "foreach: No match" and... (4 Replies)
Discussion started by: software5723
4 Replies

9. Shell Programming and Scripting

How to grep logs for errors and receive specific additional lines?

Hi there, I have a script that I've used to find errors in my Minecraft Server logs. But I'd like to refine that script to be more useful. Here is the script: grep -n "SEVERE" /minecraft/server.log | awk -F":" '{print $1-2 "," $1+10 "p"}' | xargs -t -i sed -n {} /minecraft/server.log >>... (15 Replies)
Discussion started by: nbsparks
15 Replies

10. Shell Programming and Scripting

Script to grep logs for Errors

Hi Guys, I want to write a script which can grep the logs (server.log) from a file for Error String and output to a other file. Problems: How to know about the errors only between the current restart and not in previous as server.log has earlier restarts also? thanks for the help! Much... (5 Replies)
Discussion started by: ankur328
5 Replies
schemagen(1)						      General Commands Manual						      schemagen(1)

NAME
schemagen - Java(TM) Architecture for XML Binding Schema Generator Specification Version: 2.0 Reference Implementation (RI) Version: 2.0 ea3 Launching schemagen The schema generator can be launched using the appropriate schemagen shell script in the bin directory for your platform. The current schema generator can process either Java source files or class files. We also provide an Ant task to run the schema generator - see the instructions for using schemagen with Ant. For Solaris/Linux % path/to/jaxb/bin/schemagen.sh Foo.java Bar.java ... Note: Writing schema1.xsd For WindowsNT/2000/XP > path ojaxbinschemagen.bat Foo.java Bar.java ... Note: Writing schema1.xsd If your java sources/classes reference other classes, they must be accessable on your system CLASSPATH environment variable, or they need to be given to the tool by using the -classpath/-cp options. Otherwise you will see errors when generating your schema. Command Line Options Usage: schemagen [-options ...] <java files> Options: -d <path> : Specify where to place processor and javac generated class files -cp <path> : Specify where to find user specified files -classpath <path> : Specify where to find user specified files -help : Display this usage message Generated Resource Files The current schema generator simply creates a schema file for each namespace referenced in your Java classes. There is no way to control the name of the generated schema files at this time. For that purpose, use the schema generator ant task. See Also o JAXB 2.0: * Release Notes @ http://java.sun.com/webservices/docs/2.0/jaxb/ReleaseNotes.html * XJC @ http://java.sun.com/webservices/docs/2.0/jaxb/xjc.html * XJCTask @ http://java.sun.com/webservices/docs/2.0/jaxb/xjcTask.html * SchemaGen @ http://java.sun.com/webservices/docs/2.0/jaxb/schemagen.html * schemagenTask @ http://java.sun.com/webservices/docs/2.0/jaxb/schemagenTask.html * Sample Apps @ http://java.sun.com/webservices/docs/2.0/jaxb/samples.html * Changelog @ http://java.sun.com/webservices/docs/2.0/jaxb/changelog2.html o JAXB 1.0.x: * Release Notes @ http://java.sun.com/webservices/docs/2.0/jaxb/jaxb-1_0.html * Changelog @ http://java.sun.com/webservices/docs/2.0/jaxb/changelog.html o JAXB RI Extensions: * Runtime Properties @ http://java.sun.com/webservices/docs/2.0/jaxb/vendorProperties.html * XJC Customizations @ http://java.sun.com/webservices/docs/2.0/jaxb/vendorCustomizations.html * Develop Plugins @ http://java.sun.com/webservices/docs/2.0/jaxb/developPlugins.html o JAXB RI Schema Languages: * W3C XML Schema @ http://java.sun.com/webservices/docs/2.0/jaxb/vendorSchemaLangs.html#xschema * RELAX NG @ http://java.sun.com/webservices/docs/2.0/jaxb/vendorSchemaLangs.html#relaxng * DTD @ http://java.sun.com/webservices/docs/2.0/jaxb/vendorSchemaLangs.html#dtd o JAXB Community: * Java.net Homepage @ http://jaxb.dev.java.net * Developer interest list @ https://jaxb.dev.java.net/servlets/ProjectMailingListList * FAQ @ https://jaxb.dev.java.net/faq/index.html 07 Aug 2006 schemagen(1)
All times are GMT -4. The time now is 02:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy