#1 Le 10/01/2011, à 08:19
- sdblepas
Probleme avec Mail -s [Resolu]
Salut
J'ai trouve un script tres sympas qui verifie l'addresse IP de la machine et l'envois par email des qu'elle change
#!/bin/sh
# Connects to www.whatismyip.com every 12 hours to get IP address and checks if it has changed
clear
output_filename="/home/famille/Desktop/script/ip_history.txt"
while [ 1 ]
do IPADR2=$IPADR;
IPADR=$(wget www.whatismyip.com/automation/n09230945.asp -O - -q)
dttim=$(date -j +"%d %b %Y @ %H:%M:%S")
if [ "$IPADR" != "$IPADR2" ]; then
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> $output_filename
echo ~~~~~ IP Address has changed ... $dttim >> $output_filename
echo ~~~~~ Our Old IP Address was -- $IPADR2 >> $output_filename
echo ~~~~~ Our New IP Address is --- $IPADR >> $output_filename
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> $output_filename
mail -s "IP Changed" truc@gmail.com << E_O_M
Good day Master,
I Regret to Inform You That Our IP Has Changed
Our Old IP Address was -- $IPADR2
Our New IP Address is --- $IPADR
This Occurred Within The Past 12 Hours From -- $dttim
Our Records Will Need To Be Updated At
https://my.registrar.com
Reference: $output_filename
E_O_M
else
echo IP Address is the same ... as of $dttim ... $IPADR >> $output_filename
fi
sleep 43200 # 12h = 43200
done
Donc je l'ai mis chez moi mais quand je l'execute j'ai une erreur
/usr/lib/sendmail: No such file or directory
+ sleep 43200
+ output_filename=/home/famille/Desktop/script/ip_history.txt
+ '[' 1 ']'
+ IPADR2=
++ wget www.whatismyip.com/automation/n09230945.asp -O - -q
+ IPADR=84.109.187.164
++ date '+%d %b %Y @ %H:%M:%S'
+ dttim='10 Jan 2011 @ 09:12:10'
+ '[' 1.2.3.4 '!=' '' ']'
+ echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+ echo '~~~~~' IP Address has changed ... 10 Jan 2011 @ 09:12:10
+ echo '~~~~~' Our Old IP Address was --
+ echo '~~~~~' Our New IP Address is --- 84.109.187.164
+ echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+ mail -s 'IP Changed' truc@gmail.com
/usr/lib/sendmail: No such file or directory
+ sleep 43200
"/home/famille/dead.letter" 21/558
. . . message not sent.
^C
Une idee
Merci
Dernière modification par sdblepas (Le 10/01/2011, à 12:34)
Hors ligne
#2 Le 10/01/2011, à 11:52
- FRUiT
Re : Probleme avec Mail -s [Resolu]
Et tu as installé sendmail ?
Neon Suite by FRUiT (kde4.6) [url]http://[Merci de relire les règles]/yzm7cee[/url]
"Pour la carotte, le lapin est la plus parfaite incarnation du mal" (R. Sheckley)
clean
Hors ligne
#3 Le 10/01/2011, à 12:24
- sdblepas
Re : Probleme avec Mail -s [Resolu]
FRUIT MERCI, je suis con!!!
par contre j'ai un autre probleme maintenant
+ output_filename=/home/famille/Desktop/script/ip_history.txt
+ '[' 1 ']'
+ IPADR2=
++ wget www.whatismyip.com/automation/n09230945.asp -O - -q
+ IPADR=1.2.3.4
++ date '+%d %b %Y @ %H:%M:%S'
+ dttim='10 Jan 2011 @ 13:21:36'
+ '[' 84.109.187.164 '!=' '' ']'
+ echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+ echo '~~~~~' IP Address has changed ... 10 Jan 2011 @ 13:21:36
+ echo '~~~~~' Our Old IP Address was --
+ echo '~~~~~' Our New IP Address is --- 1.2.3.4
+ echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
+ mailx -s 'IP Changed' sdblepas@gmail.com
+ sleep 43200
/var/lib/xmail/spool/temp/1294658496000.10037.famille-desktop: Permission denied
^C
Je n'aimerais pas devoir le lance en sudo
Merci
Hors ligne
#4 Le 10/01/2011, à 12:34
- sdblepas
Re : Probleme avec Mail -s [Resolu]
j'ai honte tellement je suis con je n'avais pas configure le mail
Cher moderateur s'il vous plais enlever ce message
Hors ligne