You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
536 B

#!/bin/bash
#Descobre qual o ip externo da ADSL e envia via e-mail em caso de alteracao
CLIENTE="CLIENTE"
EMAIL="suporte@simplesip.com.br"
IPNOVO=$(curl ifconfig.me)
[ -e /tmp/meuip.txt ] && IPANTIGO=$(cat /tmp/meuip.txt)
if [ -z "$IPNOVO" ]
then
exit
fi
if [ "$IPNOVO" != "$IPANTIGO" ]
then
echo -e "Subject: IP EXTERNO CLIENTE: $CLIENTE\nO ip antigo era: $IPANTIGO \nO ip novo e: $IPNOVO" | msmtp -t $EMAIL
echo "$IPNOVO" > /tmp/meuip.txt
fi
echo "O ip antigo era: $IPANTIGO"
echo "O ip novo é: $IPNOVO"