Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 1 of 1
  1. #1
    dkz
    dkz is offline
    Member
    Join Date
    Sep 2004
    Posts
    100

    Default Charset From Shell For PHP Script.

    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
    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 [ OK ] UnRouting 216.32.90.219 SIOCDELRT: No such device [FAILED] Shutting down eth0:2 SIOCSIFFLAGS: Cannot assign requested address [FAILED] UnRouting 216.32.90.221 SIOCDELRT: No such device [FAILED] Shutting down eth0:3 SIOCSIFFLAGS: Cannot assign requested address [FAILED] UnRouting 216.32.90.222 SIOCDELRT: No such device [FAILED] Shutting down eth0:4 SIOCSIFFLAGS: Cannot assign requested address [FAILED] UnRouting 216.32.90.220 SIOCDELRT: No such device [FAILED] Bringing up eth0:1 [ OK ] Routing 216.32.90.219 [ OK ] Bringing up eth0:2 [ OK ] Routing 216.32.90.221 [ OK ] Bringing up eth0:3 [ OK ] Routing 216.32.90.222 [ OK ] Bringing up eth0:4 [ OK ] Routing 216.32.90.220 [ OK ]
    Thanks For The Help!
    Last edited by dkz; 08-04-2005 at 11:49 AM.

Similar Threads & Tags
Similar threads

  1. Replies: 4
    Last Post: 10-09-2010, 10:26 AM
  2. Replies: 0
    Last Post: 09-24-2010, 02:33 AM
  3. PHP Script to Enable Jailed Shell
    By hightekhosting in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 10-12-2008, 02:26 PM
  4. PHP mail charset problems
    By remik in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 04-06-2007, 12:51 PM
  5. Automating Account Creation: Shell Script? PHP Script?
    By RangerWest in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-13-2003, 09:24 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube