Good morning Ladies and Gentlemen:
I have an error log that it is normal a zero byte file. When it grows to any length I want to be notified. How can I get a korn shell script to automate this? Does anyone know? Thank You
If you wanted something a bit more instant, then you could knock up a script ( say, myscript ) which reads from stdinput, and mails you a message as soon as it reads a line of input.
Then all you'd need to do is run a background task similar to the following:
which I believe will only search the PATH for the FILE and will only run the NOTIFY command when the size is greater than zero. You could put that in a cron script described by PSD above. The benefits that find has over ls | awk are only a single command instead of two, and it would use less resources (I may be wrong - but calling awk for a simple one line check is wasteful).
Anyhow, I hope you find your answer.
Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.