[thelist] Shell scripting help

Warden, Matt mwarden at odyssey-design.com
Mon Aug 7 11:41:44 CDT 2000


Chris,

For future shell scripting needs, I thought I'd let you know that you can
use PHP to write shell scripts. Since you know your stuff with PHP, you
might be able to write it yourself.

Rock on,

--
mattwarden
mattwarden.com


----- Original Message -----
From: Anthony Baratta <Tony at IdeaSystems.com>
To: <thelist at lists.evolt.org>
Sent: Monday, August 07, 2000 11:21 AM
Subject: Re: [thelist] Shell scripting help


> 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