Hey All,
I am looking to make a couple of scripts to do the following (seperate files, not all in one).
DNS, MySQL, POP3/IMAP+SMTP
Basically, i want to try connecting to these sources, and check they are running on the server. If they are not running, i will create a message and post it to a log file.
I have done something like:
use strict;
use CGI qw(:all);
use CGI:Carp qw ( fatalsToBroswer);
use Mysql;
use DBI;
print ("Content-type: text/html\n\n");
$DB_Host = "localhost";
$DB_Name = "test";
$DB_User = "test";
$DB_Password = "test";
print "Trying to connect to MySQL DB<br>";
if (!($dbh = Mysql->Connect($DB_Host,$DB_Name,$DB_User,$DB_Password)))
{
print "Could Not Connect to Database! Reason: ".($Mysql::db_errstr);
exit;
}
print "Successful MySQL DB Connection";
exit 0;
This works, but is there a more simple way to do this? What about the other things such as checking DNS and SMTP/POP3 services are running?
Thank you in advance
TH