handle difference in bsd vs linux tail options
This commit is contained in:
parent
bccf51d4a4
commit
df0f552ef2
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
logf='/var/log/nginx/access.log'
|
logf='/var/log/nginx/access.log'
|
||||||
cache='/tmp/forumspam_cache'
|
cache='/tmp/forumspam_cache'
|
||||||
|
tail_opts='-F' # set to `-f` on OpenBSD!
|
||||||
|
|
||||||
test -f $cache || install -m 600 /dev/null $cache
|
test -f $cache || install -m 600 /dev/null $cache
|
||||||
|
|
||||||
tail -F $logf | while read line ; do
|
tail $tail_opts $logf | while read line ; do
|
||||||
case $line in (*"POST"*)
|
case $line in (*"POST"*)
|
||||||
ip=`echo $line | awk '{print $1}'`
|
ip=`echo $line | awk '{print $1}'`
|
||||||
ip_regex=`echo $ip | sed 's/\./\\./g'`
|
ip_regex=`echo $ip | sed 's/\./\\./g'`
|
||||||
|
Reference in New Issue
Block a user