Re: Net_ping problems
| From: | Jan Lehnardt | Date: | Mon, 14 Oct 2002 18:09:02 +0000 |
| Subject: | Re: Net_ping problems | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2495@lists.php.net to get a copy of this message | ||
Hey there,
On Mon, Oct 14, 2002 at 06:35:20PM +0100, Simon H wrote:
> I'm running FreeBSD 4.7-STABLE/PHP 4.2.3 port (CLI, not mod_php, its installed
> also)
>
> I'm using Net_Ping to monitor our customers ADSL connections, running a script
> in a crontab every 15 mins. The strange thing is the script runs fine from the
> commandline, but when run from crontab I get an email from crontab telling me:
heh, there is actually somebody using it :)
> -c: Not Found
> -c: Not Found
> -c: Not Found
> -c: Not Found
> -c: Not Found
> -c: Not Found
>
> (I'm monitoring 6 IP's)
can you give me the rest of your script, I'll have a look at this asap.
> The only place I can find a "-c" is for the "count" switch in Net/Ping.php.
> I'm
> not sure if thats what this error means, but if it is, why only from a crontab
> and not from the commandline? Is it an error from the script, Ping class, cron,
> php?
the error seem to come from ping (stating that it doesn't know the option -c).
> How about wrapping the responses from the ping, rather than just providing an
> array. So that we can catch "Packets Sent", "Packets Received", etc each
> in
> their own variable, without having all the rest of the text to strip. I have
> done this crudely myself, but it is not portable, and I'm not that great at PHP
> just yet, sits likely a bit ropey!
I defenatly want this to happen, but the main problem is that ping output
on every system (even the BSD's are not on the same way here). So we need to
write a parser to find each information for every system. Looks like a neat
preg_match exercise, but I don't have the time right now, anyone? To see
how messy the OS differenecs are, have a look how the command string is
populated.
Jan
--
Q: Thank Jan? A: http://geschenke.an.dasmoped.net/
Got an old and spare laptop? Please send me a mail.
Key 7BCC EB86 8313 DDA9 25DF
Fingerprint 1805 ECA5 BCB7 BB96 56B0