I have a file (for example system.log
). I need to scan this file to find a specific string that must appear several times during a period of 5 minutes.
I imagine that I can make a script with 4 parameters:
- the location of the file
- the string to search
- the number of times that the string appears
- the period of time
If this script finds the string in the specified period of time it writes, for example, the message 'success'
Here's the begin of the script
#!/bin/ksh
#set -x
#############
# VARIABLES #
#############
location="/moteurs/websphere/7.0/esb/managed01/logs/"
file="SystemOut.log"
pattern="WSV0605W: Thread \"SIBFAPInboundThreadPool"
string=$(grep -ic "${pattern}" ${location}/${file})
Now that I've defined my variables, I don't know how can I make a function that scans SystemOut.log
every 5 minutes.