<div dir="ltr">RTFM:<br><br> exec LIST<br> exec PROGRAM LIST<br> The "exec" function executes a system command and never returns-- use "system" instead of "exec" if you<br>
want it to return. It fails and returns false only if the command does not exist and it is executed<br> directly instead of via your system's command shell (see below).<br><br>[]s,<br>Russo<br>
<br><div class="gmail_quote">2008/8/11 Agustinho Coelho <span dir="ltr"><<a href="mailto:agustinho_coelho@yahoo.com.br">agustinho_coelho@yahoo.com.br</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Boa Tarde Pessoal,<br>
<br>
Estou tentando utilizar a função exec, mas estou enfrentando dificuldades... Eu li o perldoc, tentei utilizar as diversas maneiras aprensentadas, mas sem sucesso. O programa que tento fazer é para verificar se um host da rede está funcionando, se ele não responder, ele me envia um email. (eu tentei utilizar o módulo libemail-simple-perl e libemail-send-perl, mas ainda estou muito cru para isso :S ). Segue o código:<br>
<br>
#/bin/perl -w<br>
<br>
exec ('ping -c4 <a href="http://192.168.0.122" target="_blank">192.168.0.122</a> > /dev/null 2&1');<br>
if ( $? == 0 ); then {<br>
exec ('echo "teste" | mail -s "host $(hostname) is up" <a href="mailto:email@dominio.com.br" target="_blank">email@dominio.com.br</a>');<br>
} else {<br>
exec ('echo "teste" | mail -s "host $(hostname)is down " <a href="mailto:email@dominio.com.br" target="_blank">email@dominio.com.br</a>');<br>
}<br>
<br>
<br>
Obrigado desde já,<br>
<br>
Agustinho.<br>
_______________________________________________<br>
Cascavel-pm mailing list<br>
<a href="mailto:Cascavel-pm@pm.org" target="_blank">Cascavel-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/cascavel-pm" target="_blank">http://mail.pm.org/mailman/listinfo/cascavel-pm</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Alexei Znamensky [russoz_gmail_com] [<a href="http://russoz.wordpress.com">russoz.wordpress.com</a>] [<a href="http://www.flickr.com/photos/alexeiz">www.flickr.com/photos/alexeiz</a>]<br>
"Though we live in trying times, we're the ones who have to try"<br>
</div>