1828014 Members
1893 Online
109973 Solutions
New Discussion

writing one script

 
itrc55
Regular Advisor

writing one script

Hi All,

i need to basic script will be able to look at a log file periodically and report on any new lines that contain
either "error" or "warning". The search for this text is to be "case insensitive". This means that the script
needs to accept a line containing either "error", "Error", "ERROR" or the word error spelt in any other
combination of upper and lower case letters as being functionally equivalent.
with this Specific Requirements
The basic script, named "logmon" (for log monitor) will need to do the following:
be able to run in an environment that does not include a path. (i.e. the environment provided by
cron)
1
accept the name of a log le as the sole command line argument
search the speci ed log le for lines that have been added since the previous search. (It is up to you
how you implement this - there are several possible solutions to this problem.)
construct an e-mail reporting any lines that contain either "error" or \warning" in any combination
of upper and lower case letters (This is easier than some of the alternatives.)
send the e-mail to the address speci ed in the RECIPIENT shell variable which is de ned within the
script
generally follow good scripting practice as de ned in the lab notes and Scripting Notes booklet. (Note
that the examples in the lecture notes are not to be considered good examples of scripting standards
as implementation of some aspects of the standards was intentionally omitted to allow the code to
fit on a single lecture slide.)

Thanks a lot
3 REPLIES 3
Steven Schweda
Honored Contributor

Re: writing one script

> i need to [write a] basic script [...]

What's stopping you?

> The basic script, named "logmon" (for log
> monitor) will need to do the following:
> [...]

Sounds like a good homework problem. Perhaps
you should try to do it yourself.

> [...] de ned [...]

"defined"? (If you can't do copy+paste, I
can see why you might seek help.)
S.N.S
Valued Contributor

Re: writing one script

For basic of scripting:

http://www.tldp.org/LDP/abs/html/index.html

SNS
"Genius is 1% inspiration, 99% Perspiration" - Edison
James R. Ferguson
Acclaimed Contributor

Re: writing one script

Hi:

> generally follow good scripting practice as de ned in the lab notes and Scripting Notes booklet. (Note that the examples in the lecture notes are not to be considered good examples of scripting standards as implementation of some aspects of the standards was intentionally omitted to allow the code to fit on a single lecture slide.)

This site isn't appropriate for homework assignments.

You will learn more from your course by trying its assignments yourself, rather than claiming someone else's offering as your own. Whether or not your attempts work well is immaterial.

...JRF...