[Cascavel-pm] Duvida com exec

Alexei Znamensky russoz em gmail.com
Segunda Agosto 11 13:40:41 PDT 2008


RTFM:

       exec LIST
       exec PROGRAM LIST
               The "exec" function executes a system command and never
returns-- use "system" instead of "exec" if you
               want it to return.  It fails and returns false only if the
command does not exist and it is executed
               directly instead of via your system's command shell (see
below).

[]s,
Russo

2008/8/11 Agustinho Coelho <agustinho_coelho em yahoo.com.br>

> Boa Tarde Pessoal,
>
> 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:
>
> #/bin/perl -w
>
> exec ('ping -c4 192.168.0.122 > /dev/null 2&1');
> if ( $? == 0 ); then {
>       exec ('echo "teste" | mail -s "host $(hostname) is up"
> email em dominio.com.br');
> } else {
>       exec ('echo "teste" | mail -s "host $(hostname)is down "
> email em dominio.com.br');
> }
>
>
> Obrigado desde já,
>
> Agustinho.
> _______________________________________________
> Cascavel-pm mailing list
> Cascavel-pm em pm.org
> http://mail.pm.org/mailman/listinfo/cascavel-pm
>



-- 
Alexei Znamensky [russoz_gmail_com] [russoz.wordpress.com] [
www.flickr.com/photos/alexeiz]
"Though we live in trying times, we're the ones who have to try"
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/cascavel-pm/attachments/20080811/b992550c/attachment.html>


Mais detalhes sobre a lista de discussão Cascavel-pm