Críticas sempre são bem vindas :-) <br><br>O que acontece é que com esse plugin no Linux as vezes funciona, outras não. E no windows após a execução do mesmo se o &quot;Enter&quot; não for pressionado ele não vai adiante. Ele para depois que dou o primeiro Ping. <br>
<br>Vou começar a escrever usando outro plugin cros-plataform para ping, creio que o Net::Ping seja mais estável. <br><br>O que acham?<br><br><div class="gmail_quote">2010/3/11 Otávio Fernandes <span dir="ltr">&lt;<a href="mailto:otaviof@gmail.com">otaviof@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2010/3/10 Esdras Neto &lt;<a href="mailto:esdras@gmail.com">esdras@gmail.com</a>&gt;:<br>
<div><div></div><div class="h5">&gt; Boa noite,<br>
&gt;<br>
&gt; To com umas dúvidas e o google não quer me ajudar :/<br>
&gt;<br>
&gt; Estou usando o modulo Net::Ping::External pois preciso fazer um script que<br>
&gt; monitore a conexão com a internet que funcione tanto no Windows quanto no<br>
&gt; Linux.<br>
&gt;<br>
&gt; O projeto é simples, monitorar um host externo se esse host parar de<br>
&gt; responder testar com outros hosts e caso fique sem resposta muda a rota e<br>
&gt; manda um email pros admin.<br>
&gt;<br>
&gt; Mas o net::ping::external parece nem sempre funcionar no Linux e no windows<br>
&gt; ele pede interação. Alguem da uma luz? Segue o script. vlwz!<br>
&gt;<br>
&gt; while (&lt;&gt;) {<br>
&gt;     $alive = ping(host =&gt; $HOST1, timeout =&gt; 4);<br>
&gt;     print &quot;$HOST1 is alive\n&quot; if $alive;<br>
&gt;<br>
&gt;   if (!$alive) {<br>
&gt;<br>
&gt;    my $num_alive = 0;<br>
&gt;    foreach (@hosts) {<br>
&gt;      $alive = ping(hostname =&gt; $_, timeout =&gt; 3);<br>
&gt;      print &quot;$_ is alive!\n&quot; if $alive;<br>
&gt;      $num_alive++ if $alive;<br>
&gt;<br>
&gt;    }<br>
&gt;<br>
&gt;    print &quot;$num_alive hosts are alive.\n&quot;;<br>
&gt;    if ($num_alive == &#39;0&#39;) {<br>
&gt;<br>
&gt;       my %mail = (<br>
&gt;           To=&gt;&quot;$mail_destination&quot;,<br>
&gt;           From=&gt;&quot;$from&quot;,<br>
&gt;           Subject=&gt;&quot;Network Outage&quot;,<br>
&gt;           Message=&gt;&quot;This is an automatic alert. The link is down.&quot;,<br>
&gt;           smtp=&gt;&quot;$smtp_server&quot;,<br>
&gt;           auth=&gt;{user=&gt;$from, pass=&gt;$password, method=&gt;&#39;PLAIN&#39;}<br>
&gt;           );<br>
&gt;<br>
&gt;    sendmail(%mail) or die $Mail::Sendmail::error;<br>
&gt;    }<br>
&gt;<br>
&gt;   }<br>
&gt; sleep $TBP;<br>
&gt; }<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; <a href="http://www.alvespassos.com" target="_blank">http://www.alvespassos.com</a><br>
&gt; Sharing things that we cannot buy.<br>
&gt; Mobile +353 (0)83 4005868<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; SaoPaulo-pm mailing list<br>
&gt; <a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
&gt; <a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br>
<br>
Esdras,<br>
<br>
Você precisa ser mais específico sobre os problemas, com o que foi<br>
descrito fica difícil ir além de críticas ao seu código.<br>
<br>
Atenciosamente,<br>
<font color="#888888"><br>
--<br>
Otávio Fernandes &lt;otaviof at <a href="http://gmail.com" target="_blank">gmail.com</a>&gt;<br>
<a href="http://blog.emresumo.com" target="_blank">http://blog.emresumo.com</a><br>
_______________________________________________<br>
SaoPaulo-pm mailing list<br>
<a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.alvespassos.com">http://www.alvespassos.com</a><br>Sharing things that we cannot buy.<br>Mobile +353 (0)83 4005868<br>