clean up temp file before exiting
This commit is contained in:
parent
36739fc638
commit
3fc9117bff
@ -10,18 +10,23 @@ curl 'http://api.stopforumspam.org/api?ip='$ip 2>/dev/null > $repl
|
|||||||
|
|
||||||
if ! grep -q '<response success="true">' $repl; then
|
if ! grep -q '<response success="true">' $repl; then
|
||||||
echo error failed to query stopforumspam api >> $logf
|
echo error failed to query stopforumspam api >> $logf
|
||||||
|
rm $repl
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! grep -q '<appears>yes</appears>' $repl; then
|
if ! grep -q '<appears>yes</appears>' $repl; then
|
||||||
|
rm $repl
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
freq=`grep '<frequency>' $repl | sed 's/<frequency>//; s!</frequency>!!'`
|
freq=`grep '<frequency>' $repl | sed 's/<frequency>//; s!</frequency>!!'`
|
||||||
if [ "$freq" -ge 1 ]; then
|
if [ "$freq" -ge 1 ]; then
|
||||||
if ufw deny from $ip >/dev/null; then
|
if ufw deny from $ip >/dev/null; then
|
||||||
echo `date` blocked ip $ip with freq $freq >> $logf
|
echo `date` blocked ip $ip with freq $freq >> $logf
|
||||||
|
rm $repl
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo error failed to add ufw rule >> $logf
|
echo error failed to add ufw rule >> $logf
|
||||||
|
rm $repl
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
rm $repl
|
||||||
|
Reference in New Issue
Block a user