Re: Running afacli in a cron?

Andrew Teixeira <[email protected]> Sat, 30 Aug 2003 14:09:35 -0400 (EDT)
Newsgroups gmane.linux.drivers.aacraid.devel
Message-ID <[email protected]>
Hello,
	This is my first time responding to this list, but since I've had 
some issues along the same lines, I thought I would throw my 2 cents in.  
My problem wasn't with a PowerEdge 1650 also.  The script would run if run 
as a user, but not through Cron.  The problem ended up being that the 
afacli script needs the TERM environment variable to be set (or at least 
that fixed it for me.  See my scripts below:

#----Perl script for executing an afacli session to find battery state.
#!/usr/bin/perl -w

$LOG = "/tmp/cfg.log";
$AFACLI = "/usr/sbin/afacli";
$AFACFG = "/etc/afaapps/contrDetails.afa0";

`$AFACLI < $AFACFG 2> /dev/null`;

$_ = `grep "Battery State" $LOG`;
chomp;
@data = split (/:/);
$data[1] =~ s/^\s*//;
$_ = lc($data[1]);

if ( ! /ok/ )
{
    print "Battery State: $_\n";
}

`rm -f $LOG`; 
exit 0;

#----Shell script called by Cron which in turn calls the above perl 
#----script.

#!/bin/sh

HOME=/root
TERM=vt100 
export TERM HOME

/etc/afaapps/batteryTest.pl

#----/etc/afaapps/contrDetails.afa0 file

 logfile start "/tmp/cfg.log"
 open /readonly=TRUE afa0
 controller details
 logfile end
 exit


---------------------------------------------------------------------
Andrew Teixeira
Department of Math and Computer Science
Suffolk University                           [email protected]
---------------------------------------------------------------------

On Sat, 30 Aug 2003, Colbey wrote:

> 
> Here's my script if you want to take a lookse:
> 
> #!/bin/sh
> /usr/sbin/afacli < /usr/local/raid/raid.commands
> /bin/mail -s "[server] PE2450 Raid Status" [email protected] <
> /usr/local/raid/raid.status
> 
> -- and raid.commands --
> open afa0
> logfile start raid.status
> disk show smart
> container list
> disk list
> enclosure show temperature
> logfile end
> exit
> 
> 
> 
> 
> 
> On Sat, 30 Aug 2003, Kurt Milligan wrote:
> 
> > Hi
> >
> > I have a bunch of PowerEdge 1650 servers all configured with RAID 5,
> > using RH7.3, and have afacli installed.
> >
> > I've been trying to use Kent Ziebell's monitoring script
> > (http://www.domsch.com/linux/aacraid/aacraid_monitoring_script.txt)
> > but can't for the life of me get it to run from a cronjob.
> > Runs fine when run manually from the command line, though.
> >
> > I've tried adding in all of my environment variables and trying various
> > different redirects, and adding whitespace in the raid.commands file as
> > suggested in the notes. Have you heard of anyone else that has
> > successfully gotten this to work from cron?
> >
> > TIA
> >
> > Kurt Milligan
> >
> >
> > _______________________________________________
> > Linux-aacraid-devel mailing list
> > [email protected]
> > http://lists.us.dell.com/mailman/listinfo/linux-aacraid-devel
> > Please read the FAQ at http://lists.us.dell.com/faq or search the list archives at http://lists.us.dell.com/htdig/
> >
> 
> _______________________________________________
> Linux-aacraid-devel mailing list
> [email protected]
> http://lists.us.dell.com/mailman/listinfo/linux-aacraid-devel
> Please read the FAQ at http://lists.us.dell.com/faq or search the list archives at http://lists.us.dell.com/htdig/
> 

_______________________________________________
Linux-aacraid-devel mailing list
[email protected]
http://lists.us.dell.com/mailman/listinfo/linux-aacraid-devel
Please read the FAQ at http://lists.us.dell.com/faq or search the list archives at http://lists.us.dell.com/htdig/