Ale ma non è un discorso di esistere o meno ... il gruppo più bello è proprio la community ;)<div><br></div><div>Comunque ho appena sfornato la RC1</div><div><br></div><div>Rispetto al precedente</div><div><ul><li>controlla l'esistenza della directory</li>
<li>semplifica l'inserimento del gateway e dell'host oggetto dei test</li><li>crea un file di log giornliero</li><li>alleggerisce il log (meno righe)<br></li></ul><div><br></div></div><div><br></div><div><div>#######################[CUT ME]#######################</div>
<div><br></div><div>#!/bin/bash</div><div>#</div><div># EASY IP LOGGER RC1</div><div>#</div><div>DIR="/var/log/IP_LOG/"</div><div>if [ -d ${DIR} ]</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>then</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>DIR=$DIR</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>else</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mkdir /var/log/IP_LOG</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>DIR="/var/log/IP_LOG/"</div><div>fi</div><div>HOST="<a href="http://www.google.com">www.google.com</a>"</div><div>GW="192.168.1.254"</div>
<div>while true; do</div><div> FILE=${DIR}`date "+%Y_%m_%d"`.log</div><div> test_ping=$(echo $(ping -c 1 ${HOST} | grep "packet loss" | awk ' BEGIN { FS = ", " } ; {print $3} ' | awk ' {print $1} ' | cut -d'%' -f1))</div>
<div> test_gw=$(echo $(ping -c 1 ${GW} | grep "packet loss" | awk ' BEGIN { FS = ", " } ; {print $3} ' | awk ' {print $1} ' | cut -d'%' -f1))</div><div> if [ ${test_ping} -eq 0 -a ${test_gw} -eq 0 ]</div>
<div> then</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>echo -e $(curl -s <a href="http://checkip.dyndns.com">checkip.dyndns.com</a> | awk ' BEGIN { FS = ": " } ; {print $2} ' | cut -d '<' -f1 | while read host; do echo -e "[$(date +"\033[01;32m%F\033[00m \033[01;31m%T\033[00m")] MY IP IS REACHABLE: [${host}]"; done) >> ${FILE}</div>
<div> elif [ ${test_ping} -ne 0 -a ${test_gw} -eq 0 ]</div><div> then</div><div> echo -e "[$(date +"\033[01;32m%F\033[00m \033[01;31m%T\033[00m")] YOUR INTERNET CONNECTION UNAVAILABLE" >> ${FILE}</div>
<div> echo -e "[$(date +"\033[01;32m%F\033[00m \033[01;31m%T\033[00m")] BUT YOUR GW [${GW}] IS REACHABLE" >> ${FILE}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>else</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>echo -e "[$(date +"\033[01;32m%F\033[00m \033[01;31m%T\033[00m")] YOUR INTERNET CONNECTION IS UNAVAILABLE" >> ${FILE}</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>echo -e "[$(date +"\033[01;32m%F\033[00m \033[01;31m%T\033[00m")] AND YOUR GW [${GW}] IS UNREACHABLE" >> ${FILE}</div><div> fi</div>
<div> sleep 60</div><div>done</div><div>exit 0</div><div><br></div><div>#######################[CUT ME]#######################</div></div><div><br></div><div><br class="Apple-interchange-newline">-- <br><pre cols="72">
<span style="background-color:rgb(255,255,255);white-space:normal"><font face="'comic sans ms', sans-serif"><pre cols="72"><i>Arka
<br></i></pre></font></span></pre></div><div><br><div class="gmail_quote">Il giorno 13 aprile 2013 13:59, Alessandro Gubitosi <span dir="ltr"><<a href="mailto:gubi.ale@gotanotherway.com" target="_blank">gubi.ale@gotanotherway.com</a>></span> ha scritto:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div text="#000000" bgcolor="#ffffff">
<font face="Helvetica, Arial, sans-serif">E poi dicono che il gruppo
software non esiste-non funziona...<br>
Queste sono cose degne da wiki :)<br>
Grande grazie<br>
</font><br>
Il 12/04/2013 11:29, Alessandro (aka ArkaNet) ha scritto:
<blockquote type="cite"><div><div class="h5">
<div>Capita spesso a chi possiede una semplice linea adsl con IP
dinamico</div>
<div>di vedere il proprio IP cambiare frequentemente</div>
<div>ecco un semplice script per tenerne traccia</div>
<div><br>
</div>
<div>-----------------------------------------------------------[CUT
ME]-----------------------------------------------------------</div>
<div><br>
</div>
<div>#!/bin/bash</div>
<div>#</div>
<div># EASY IP LOGGER</div>
<div>#</div>
<div>mkdir /var/log/IP_CHECK</div>
<div>touch /var/log/IP_CHECK/ip.log</div>
<div>DIR="/var/log/IP_CHECK/ip.log"</div>
<div><br>
</div>
<div>while true; do</div>
<div><span style="white-space:pre-wrap"> </span>echo
-e "\n#################### [$(date +"\033[01;32m%F\033[00m
\033[01;31m%T\033[00m")] ######################" >> $DIR</div>
<div><span style="white-space:pre-wrap"> </span>test_ping=$(ping
-c 3 <a href="http://www.google.com" target="_blank">www.google.com</a>
| while read pong; do echo -e "[$(date +"\033[01;32m%F\033[00m
\033[01;31m%T\033[00m")] ${pong}"; done)</div>
<div><span style="white-space:pre-wrap"> </span>test_ip=$(curl
-s <a href="http://checkip.dyndns.com" target="_blank">checkip.dyndns.com</a>
| awk ' BEGIN { FS = ": " } ; {print $2} ' | cut -d '<' -f1 |
while read ip; do echo -e "[$(date +"\033[01;32m%F\033[00m
\033[01;31m%T\033[00m")] ${ip}"; done)</div>
<div><span style="white-space:pre-wrap"> </span>echo
-e "${test_ping}\n" >> $DIR</div>
<div><span style="white-space:pre-wrap"> </span>echo
"${test_ip}" >> $DIR</div>
<div><span style="white-space:pre-wrap"> </span>echo
-e
"#################################################################\n"
>> $DIR</div>
<div><span style="white-space:pre-wrap"> </span>sleep
60</div>
<div>done</div>
<div>exit 0</div>
<div><br>
</div>
<div>-----------------------------------------------------------[CUT
ME]-----------------------------------------------------------</div>
<div><br>
</div>
<div><br>
</div>
-- <br>
<pre cols="72"><span style="white-space:normal"><font face="'comic sans ms', sans-serif"><pre cols="72"><i>Arka
</i></pre></font></span></pre>
</div></div><pre><fieldset></fieldset>
_______________________________________________
Not-wireless mailing list
<a href="mailto:Not-wireless@ml.ninux.org" target="_blank">Not-wireless@ml.ninux.org</a>
<a href="http://ml.ninux.org/mailman/listinfo/not-wireless" target="_blank">http://ml.ninux.org/mailman/listinfo/not-wireless</a>
</pre>
</blockquote>
</div>
<br>_______________________________________________<br>
Not-wireless mailing list<br>
<a href="mailto:Not-wireless@ml.ninux.org">Not-wireless@ml.ninux.org</a><br>
<a href="http://ml.ninux.org/mailman/listinfo/not-wireless" target="_blank">http://ml.ninux.org/mailman/listinfo/not-wireless</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>
</div>