[Fwd: Re[2]: [thelist] Shell scripting help]

Daniel J. Cody dcody at oracular.com
Mon Aug 7 12:10:23 CDT 2000


-------- Original Message --------
Subject: Re[2]: [thelist] Shell scripting help
Date: Mon, 7 Aug 2000 13:01:44 -0500
From: Christopher Ditty <CDitty at email.usps.gov>
To: thelist-admin <thelist-admin at lists.evolt.org>


     I did think about doing that, but a thought came to mind that PHP
     Scripts can't do things like run the rc program.  (can they?)

     This is mainly for my mysql problem.  I am going to play with the
     little script that Anthony sent and see if it will restart the
server
     if it is down.  I HOPE that this will work.

     Chris


______________________________ Reply Separator
_________________________________
Subject: Re: [thelist] Shell scripting help
Author:  thelist-admin at lists.evolt.org at INTERNET
Date:    8/7/00 12:52 PM


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 !
>


---------------------------------------
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