Can someone shed me some light, point me in the right direction?
I want to create a script in bash that will checks exceptions in the logs during the startup of Tomcat app. This script should be able to detect the creation of new files on the fly maybe via inotify
.
This script should be constantly checking the logs directory for new lines in log files and write the one that contain the words Exception:
or ERROR
to /var/log/errorcheckernotifier.txt
.
When the script detects this line INFO: Server startup in
it should write TOMCAT IS STARTED
in /var/log/errorcheckernotifier.txt
and the number of exceptions detected during the startup.
This script should not overwrite whats in the errorcheckernotifier.txt
. Append it instead.
How can I possibly keep this script running and detect further startup, count exceptions, etc.