Quote:
Originally Posted by markotitel
Hi people, I was searching on squid monitoring events and run a script but no real luck.
Do you have any ideas how to solve this?
For example, I need a script that will run when event acces denied occurs. Actual script will watch that event and take IP wihch is denied and after 15 minutes it will channge ACL to allow and reconfigure squid.
|
Ok, so what have you done/tried to write this script?? Bear in mind this is not squid specific...what you're looking for is something that watches a log file, and does something when it sees a pattern. There are ample examples you can find on Google...a very simple one would be:
Code:
tail -f some-logfile | awk '/some-pattern/ {system("run-some-command")}'
...which will look for a pattern in a log file, and run a single command when it sees it. More complex:
Code:
tail -fn0 logfile | \
while read line ; do
echo "$line" | grep "pattern"
if [ $? = 0 ]
then
... do something ...
... do something else...
... do something else...
fi
done