[Fwd: Re[2]: [thelist] Shell scripting help]
Daniel J. Cody
dcody at oracular.com
Mon Aug 7 12:10:11 CDT 2000
-------- Original Message --------
Subject: Re[2]: [thelist] Shell scripting help
Date: Mon, 7 Aug 2000 12:53:25 -0500
From: Christopher Ditty <CDitty at email.usps.gov>
To: thelist-admin <thelist-admin at lists.evolt.org>
Thank you sir. I will play with this tonight. Don't suppose you
have
any other little scripts that you might want to share that would
make
life easier would you? :)
CDitty
thanks again.
______________________________ Reply Separator
_________________________________
Subject: Re: [thelist] Shell scripting help
Author: thelist-admin at lists.evolt.org at INTERNET
Date: 8/7/00 11:33 AM
At 08:44 AM 8/7/2000, you wrote:
> Can anyone help me write a shell script for my unix box? What I am
> trying to do is have a script connect to a mysql server and verify
> that it is up. If it is not up then send and email to me. Sound
> pretty simple, but I don't know how to even get started.
do a mysql -V and cut and paste the answer to the $varExpected variable.
find your full path the mysql (whereis mysql) and cut and paste the
answer
into $varMySQLexe. find your Sendmail executable and put the full path
into
$varSendMail. lastly, put your email address into $varContact.
Might need a little debugging, but should get you started.
#!/usr/bin/perl
#
#
$varExpected = "mysql Ver 9.32 Distrib 3.22.21, for pc-linux-gnu
(i686)";
$varMySQLexe = "/usr/local/mysql/bin";
$varSendMail = "/usr/sbin/sendmail -t -n"
$varContact = "emergency at email.com"
$varFound = `$varMySQLexe/mysql -V`;
$varDate = `date`;
if ($varExpected != $varFound) {
open (MAIL, "| $varSendMail") || print "cannot open mail
program";
print MAIL "To: $varEmailTech \n";
print MAIL "From: mySQL_Cron_Job \n";
print MAIL "Subject: Can not find mySQL daemon\n\n";
print MAIL "At $varDate.\n\n";
print MAIL "Cron found $varFound.\n\n";
print MAIL "Cron expected $varExpected.\n\n";
print MAIL " \n\n";
close(MAIL) || print "mail pipe exited $?";
}
end'
----
Anthony Baratta
Isys Idea Systems
voice 510-452-4554
fax 510-452-4641
---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !
More information about the thelist
mailing list