Author |
Message |
php4ever
Junior WebHelper
Joined: 10 Oct 2002
Posts: 49
|
Posted:
Thu Jun 20, 2002 5:36 pm (21 years, 10 months ago) |
|
As of just a few minutes ago today, Thurs 6/20/02:
Database Server
server0002 .......................... DOWN
server0005 ......................... UP
server0019 .......................... UP
server0047 ........................... DOWN
if anyone knows of any other database servers at f2s let me know so I can include them, too. |
|
|
|
|
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sun Jun 23, 2002 4:52 pm (21 years, 10 months ago) |
|
hmmmmmm, I know this is not related, but I'm looking for a script that can perhaps ping/ test to see if a certain server is online or not and give answers automatically, any ideas? |
|
|
|
|
php4ever
Junior WebHelper
Joined: 10 Oct 2002
Posts: 49
|
Posted:
Sun Jun 23, 2002 8:53 pm (21 years, 10 months ago) |
|
Here's a little ping script where you can put in the ip you're interested in testing and then you could use the script with a crontab:
<?
$ip = "www.oreillynet.com";
// ping some server five times and store output in array $output
exec("ping -c 5 $ip", $output);
// format each line of output
while (list(,$val) = each($output)) :
print "<pre>$val</pre>";
endwhile;
?>
Found this little gem sometime ago from the O'Reilly ONLAMP site.
But, if you want something a little better, check out the "Ping-It" script at hotscripts:
http://www.hotscripts.com/PHP/Scripts_and_Programs/Networking_Tools/Ping/
The interface on "Ping-It" is nice and the results are intelligible.
BTW, make sure you have a server that has the ping utility available. f2s apparently doesn't make ping available to users! |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Mon Jun 24, 2002 7:47 am (21 years, 10 months ago) |
|
I think it's more a question of whether PHP is running in safe mode. PHP won't let you run that kind of command in safe mode, that's probably why it doesn't work at F2S. |
________________________________
|
|
|
|
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Mon Jun 24, 2002 10:39 am (21 years, 10 months ago) |
|
Daniel wrote: | I think it's more a question of whether PHP is running in safe mode. PHP won't let you run that kind of command in safe mode, that's probably why it doesn't work at F2S. |
Hence why I don't use F2S or Cyberwings....... |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Mon Jun 24, 2002 10:43 am (21 years, 10 months ago) |
|
I just found out that Cyberwings' servers are no longer running safe mode... |
________________________________
|
|
|
|
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Mon Jun 24, 2002 10:57 am (21 years, 10 months ago) |
|
Daniel wrote: | I just found out that Cyberwings' servers are no longer running safe mode... |
Plesk 12 was last time I checked, that server is what nightmares are made of, an average of 55% uptime over the past 2 weeks, thats even worse than server39 was on f2s........ |
|
|
|
|
Ben
Senior WebHelper
Joined: 08 Jan 2002
Posts: 431
Location: Liverpool - UK
|
Posted:
Mon Jun 24, 2002 5:02 pm (21 years, 10 months ago) |
|
Justin wrote: | Daniel wrote: | I think it's more a question of whether PHP is running in safe mode. PHP won't let you run that kind of command in safe mode, that's probably why it doesn't work at F2S. |
Hence why I don't use F2S or Cyberwings....... |
Cyberwings turn safe mode off if you ask them too...
Edit just read Daniels post and so it seems they no longer run in safe mode at all... |
________________________________ Ben Scott
Red and White Kop |
|
|
|
php4ever
Junior WebHelper
Joined: 10 Oct 2002
Posts: 49
|
Posted:
Fri Jun 28, 2002 9:55 pm (21 years, 10 months ago) |
|
Okay, after putting together Daniel's observation with what a buddy of mine told me about ping, I was able to get ping to work at f2s a few minutes ago. Woo-hoo!
Here's the script I used:
#!/usr/bin/php
<?
// ping some server five times and store output in array $output
exec("ping -c 5 server0002.freedom2surf.net", $output);
// format each line of output
while (list(,$val) = each($output)) :
print "<pre>$val</pre>";
endwhile;
?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note: the #!/usr/bin/php is required for a command of this type b/c as Daniel so rightly noted PHP runs in safe-mode @ f2s. This command basically says use the php binary rather than the server module.
If you try ping without the -c in a script, the script may just hang. The -c paremeter (shorthand for count) basically says "Stop after sending (and receiving) count ECHO_RESPONSE packets."
And, for you newbies who may be wondering what the pre tags are doing in this code, they help to make the output more readable b/c without them it might be diffcult to easily view the resulting output.
And, the resulting output looked, unsurprisingly, like this today:
PING server0002.freedom2surf.net (194.106.33.37): 56 data bytes
--- server0002.freedom2surf.net ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss
~~~~~~~~~~~~~~~~~
If you are interested in more of the details about ping, here's a really good url:
http://www.oreillynet.com/linux/cmd/p/ping.html
And, here's where I found a working php ping script and they have other networking scripts, too:
http://www.onlamp.com/pub/a/php/2001/04/05/networking.html?page=3
-- php4ever |
|
|
|
|
Justin
4WebHelp Addict
Joined: 07 Jan 2002
Posts: 1060
|
Posted:
Sat Jun 29, 2002 12:52 pm (21 years, 10 months ago) |
|
Thanks for that, will come in useful |
|
|
|
|
Garth Farley
WebHelper
Joined: 08 Jan 2002
Posts: 69
Location: Ireland
|
Posted:
Tue Jul 02, 2002 12:34 am (21 years, 9 months ago) |
|
Note that if you are on a Windows server, you use -n instead of -c. This is system call, so if you are moving your scripts, PHP cannot fix it for you.
Garth Farley |
|
|
|
|
|