Saint escreveu:
> estava pensando como faria pra enviar informações de uma estação usando 
> slackware para  meu email? o ip de ppp0, etc, por onde começaria?

Ops,

Tenho um desses pronto aqui:

Antes de rodar a primeira vez é só jogar um ip falso no arquivo, assim:

echo "123.123.123.123" > /etc/ip






#!/bin/bash
#
# arquivo que armazena o ultimo endereco ip coletado
ARQUIVO_IP="/etc/ip"
#
# ultimo ip coletado
IP_ANTIGO=`cat $ARQUIVO_IP`
#
# interfaca ppp
IF_PPP=`pppoe-status | grep Link  | awk '{print $9}'`
#
# ip coletado atualmente
IP_ATUAL=`ifconfig $IF_PPP | grep inet | awk '{print }' | cut -d : -f 2
| awk '{print $1}'`
#
# verificacao de mudaca de IP
#
TAMANHO_ARQUIVO_IP=`wc -l /etc/ip | awk '{print $1}'`
if [ $TAMANHO_ARQUIVO_IP -lt 1 ]
then
        IP_ANTIGO="123.123.123.123"
fi
        if [ $IP_ATUAL != $IP_ANTIGO ]
        then
        # ------------------------------------------------------------------
        # email
        #
        # destinatario do e-mail
        DESTINATARIO="[EMAIL PROTECTED]"
        #
        # assunto da menssagem
        ASSUNTO="Mudanca de IP"
        #
        # menssagem
        MENSAGEM="Endereco IP Velox alterado para $IP_ATUAL $IF_PPP"
        #
        # ------------------------------------------------------------------
        # envia_email
        echo "$MENSAGEM" | mail -s "$ASSUNTO" "$DESTINATARIO"
        echo $IP_ATUAL > $ARQUIVO_IP
        fi




-- 
Heros Eloi
LinuxUser #359892

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
GUS-BR - Grupo de Usuarios Slackware - BR
http://www.slackwarebrasil.org/
http://www.linuxmag.com.br/mailman/listinfo/slack-users

Archives:
- http://www.mail-archive.com/[email protected]/
- http://news.gmane.org/gmane.org.user-groups.linux.brazil.slackware/

Responder a