I wish to use Ping to test if some IP addresses are up... Now I could run
the command and parse to find various string components like this:

[EMAIL PROTECTED] bin]# ping -n -c 3 -w 2 -q 192.168.1.60
PING 192.168.1.60 (192.168.1.60) from 192.168.1.1 : 56(84) bytes of data.
--- 192.168.1.60 ping statistics ---
2 packets transmitted, 0 received, 100% loss, time 1012ms


[EMAIL PROTECTED] bin]# ping -n -c 3 -w 2 -q 192.168.1.4 
PING 192.168.1.4 (192.168.1.4) from 192.168.1.1 : 56(84) bytes of data.
--- 192.168.1.4 ping statistics ---
2 packets transmitted, 2 received, 0% loss, time 999ms
rtt min/avg/max/mdev = 0.322/0.340/0.358/0.018 ms


but it would be much more efficient if I could just use the built in exit
codes that 'ping' provides as per 'man ping':

"If ping does not receive any reply packets at all  it  will  exit  with
 code  1.  If  a packet count and deadline are both specified, and fewer
 than count packets are received by the time the deadline  has  arrived,
 it  will  also  exit with code 1.  On other error it exits with code 2.
 Otherwise it exits with code 0. This makes it possible to use the  exit
 code to see if a host is alive or not."

So it seems to me there needs to be another PHP function like exec(),
shell(), etc. that is the equivillent of the php exit() function but for
external programs. One that simply returns the integer exit code of an
executed shell program...


http://daevid.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to