basta usar a seguinte sintaxe:
./script.sh IP_DO_SERVIDOR
###########################################################################
#!/bin/bash
RED="\033[01;31m"
GREEN="\033[01;32m"
FG_DEFAULT="\033[01;00m"
WHITE="\033[1;37m"
#####################################
MAILTO="<E-mail que vai receber relatorio>"
COPIAS="-c <Copia do relatorio>"
IP_MTA=$1
wget --output-document=$IP_MTA.chk "http://www.spamcop.net/w3m?action=checkblock&ip=$IP_MTA" &> /dev/null
# Checa se o arquivo existe
if [ ! -e status.chk ]
then
touch status.chk
echo 0 > status.chk
fi
# Checa se o IP passado esta na blacklist
if grep "not listed in bl.spamcop.net" $IP_MTA.chk > /dev/null
then
echo
echo -e $WHITE"O IP do MTA $GREEN$IP_MTA$WHITE nao esta na blacklist"$FG_DEFAULT
rm -rf $IP_MTA.chk
STATUS=$(cat status.chk)
if [ $STATUS = 1 ]
then
echo "IP $IP_MTA Liberado da Blacklist" | /usr/bin/mutt -s "BlackList IP Check - Spamcop" $MAILTO $COPIAS
echo -e $WHITE"O IP do MTA $GREEN$IP_MTA$WHITE foi liberado da blacklist"$FG_DEFAULT
echo 0 > status.chk
#else
fi
else
echo "IP $IP_MTA Listado em Blacklist" | /usr/bin/mutt -s "BlackList IP Check - Spamcop" $MAILTO $COPIAS
echo -e $WHITE"O IP do MTA $RED$IP_MTA$WHITE esta na blacklist"$FG_DEFAULT
rm -rf $IP_MTA.chk
echo 1 > status.chk
fi
###########################################################################
Enjoy the Code ;)
0sem comentários ainda