It is supposed to display the down gif when any one of the variables in brackets i.e ($mx1pop|$mx1imap) is not responding, but if i take one of the servers down, it waits for ages before still displaying the up gif.#!/usr/bin/perl use IO::Socket::INET; $ns1dns = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 53, Proto => 'tcp'); $ns2dns = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 53, Proto => 'tcp'); $ns3dns = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 53, Proto => 'tcp'); $ns4dns = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 53, Proto => 'tcp'); $mx1pop3 = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 995, Proto => 'tcp'); $mx1imap = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 993, Proto => 'tcp'); $mx1smtp = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 25, Proto => 'tcp'); $mx1web = IO::Socket::INET->new( PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => 80, Proto => 'tcp'); print "Content-type: text/html\n\n"; # Web Services if ($mx1web) { print "<IMG SRC='http://www.xxx.com/images/up.gif' WIDTH=38 HEIGHT=2 +1>"; } else { print "<IMG SRC='http://www.xxx.com/images/down.gif' WIDTH=38 HEIGHT +=21>"; } print "<br>"; # DNS Services if ($ns1dns|$ns2dns|ns3dns|ns4dns) { print "<IMG SRC='http://www.xxx.com/images/up.gif' WIDTH=38 HEIGHT=2 +1>"; } else { print "<IMG SRC='http://www.xxx.com/images/down.gif' WIDTH=38 HEIGHT +=21>"; } print "<br>"; #Mail Services if ($mx1pop3|$mx1imap|mx1smtp) { print "<IMG SRC='http://www.xxx.com/images/up.gif' WIDTH=38 HEIGHT=2 +1>"; } else { print "<IMG SRC='http://www.xxx.com/images/down.gif' WIDTH=38 HEIGHT +=21>"; } print "<br>";
In reply to Whats wrong with this? & Timeouts by lostperls
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |