Hello,
I have been having a problem that my dedicated IP's go down and become unreachable. I have no idea why or the time so I created a script that checks a website on a dedicated IP every 5 minutes and if found down it restarts IP alias. This will at least keep the sites up and give me an idea of when this is happening. The problem is I have the script output the details from the restart but they are in a diffrent charset. Any idea what charset I should use? Here is the script (in case someone needs it or if anyone has any suggestions for it and the output.
Script
PHP Code:#!/usr/bin/php
<?
//Don't Forget To Add An Address Below. Do Not Include http://
$address = "INSERT ADDRESS HERE";
$sock = @fopen("http://$address", 'r');
$time =date("g:i:s F j Y");
if (!$sock) {
$ip = shell_exec("/etc/init.d/ipaliases restart");
$subject="IP Down...";
$msg="The IP's Went Down at $time. They should have been restarted.<br>
Here is the output.<br><br>
$ip";
$mailheaders="From: server";
$email = "dustin@smarter-hosting.com";
$headers = 'From: Server <root@netonenetworks.com>' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail ($email, $subject, $msg, $headers);
//echo "$ip";
}
?>
Output
Thanks For The Help!Code:The IP's Went Down at 10:20:37 August 4 2005. They should have been restarted. Here is the output. Shutting down eth0:1 [60G[ [0;32mOK[0;39m ] UnRouting 216.32.90.219 SIOCDELRT: No such device [60G[[0;31mFAILED[0;39m] Shutting down eth0:2 SIOCSIFFLAGS: Cannot assign requested address [60G[[0;31mFAILED[0;39m] UnRouting 216.32.90.221 SIOCDELRT: No such device [60G[[0;31mFAILED[0;39m] Shutting down eth0:3 SIOCSIFFLAGS: Cannot assign requested address [60G[[0;31mFAILED[0;39m] UnRouting 216.32.90.222 SIOCDELRT: No such device [60G[[0;31mFAILED[0;39m] Shutting down eth0:4 SIOCSIFFLAGS: Cannot assign requested address [60G[[0;31mFAILED[0;39m] UnRouting 216.32.90.220 SIOCDELRT: No such device [60G[[0;31mFAILED[0;39m] Bringing up eth0:1 [60G[ [0;32mOK[0;39m ] Routing 216.32.90.219 [60G[ [0;32mOK[0;39m ] Bringing up eth0:2 [60G[ [0;32mOK[0;39m ] Routing 216.32.90.221 [60G[ [0;32mOK[0;39m ] Bringing up eth0:3 [60G[ [0;32mOK[0;39m ] Routing 216.32.90.222 [60G[ [0;32mOK[0;39m ] Bringing up eth0:4 [60G[ [0;32mOK[0;39m ] Routing 216.32.90.220 [60G[ [0;32mOK[0;39m ]



LinkBack URL
About LinkBacks
Reply With Quote




