Loading ...
Sorry, an error occurred while loading the content.
 

Echo results

Expand Messages
  • Jeremiah Megie
    I wrote this to check to see if the mailserver was running, and then to display the results on a webpage. It was working, but it wouldn t echo the results.
    Message 1 of 1 , Jun 2, 2001
      I wrote this to check to see if the mailserver was running, and then to
      display the results on a webpage. It was working, but it wouldn't echo the
      results. It always said it was "stopped". I tried to fix it, but now I get
      this error:

      Prototype not terminated at./mailstatus.cgi line 7.

      Any suggestions on that, and the echo results?

      Thanks,

      Jeremiah


      #!/usr/bin/perl

      use Net::Telnet;

      $checkmail="ps -ax | grep sendmail";

      sub check_mail (
      $host = 'mail.foo.com';
      $username = 'USERNAME';
      $passwd = 'PASSWORD';

      $t = Net::Telnet->new( Timeout => 10,
      Host => $host,
      Dump_Log => '/tmp/mailstatus.log');

      $t->login($username, $passwd);
      $t->telnetmode('0');
      $t->waitfor(/#/i);
      $t->print("$checkmail");
      $t->waitfor(/#/i);
      $t->close;
      }

      chomp ($checkmail);
      ($checkmail) = split / +|\s|\t/,$checkmail;
      if ($checkmail ne "") {
      $status = "Running";
      $color = "green";
      }
      else {
      $status = "Stopped";
      $color = "red";
      }

      printf "<font color=\"$color\">$status</font>";

      __END__





      _______________________________________________________
      Send a cool gift with your E-Card
      http://www.bluemountain.com/giftcenter/
    Your message has been successfully submitted and would be delivered to recipients shortly.