running afacli in a cron job

Pierre Wendling pwendling at sopragroup.com
Tue Dec 3 07:31:01 CST 2002


Thanks for your reply.

However, for some reason, it still doesn't work here.

I've tried to build a really simple script (took my perl script out of 
the equation):

===============================================
#!/bin/ksh

exec > /var/tmp/foo.out 2> /var/tmp/foo.err

cd /var/tmp
cat  - <<EOR | afacli
   open afa0
   logfile start "/var/tmp/afalog.$$"
   container list /full
   disk list /full
   logfile end
   exit
EOR
===============================================

It works perfectly from the command line, but fails when launched 
through at(1) with the following message:

==== /var/tmp/foo.err =========================
Error opening terminal: unknown.
===============================================

I tried to invoke afacli with the 'afacli @some-cmds-list.txt' syntax, 
but this stops at the 'FASTCMD>' prompt when run interactively, not 
reading any of the commands from the file. Same 'Error opening terminal: 
unknown.' when started through at(1)

Obviously, some people on this list were able to successfully run afacli 
from cron(1) and/or using a file with all the commands inside. I can't 
understand why it doesn't work here:
- what version of RedHat/afacli are you running ?
- any script example I can try here ?

TIA
Pierre

Hubbard, David wrote:
> Put all of your afacli commands into a text file and feed
> it in using afacli's support for the @<file> argument.
> I have a cron that runs this command:
> 
> afacli @disk-check.txt
> 
> And in the file disk-check.txt it just has this:
> open afa0
> disk list
> container list
> enclosure show status
> 
> So then my cron makes sure no disks are dead and the
> temperatures aren't too high.
> 
> David
> 
> 
>>-----Original Message-----
>>From: Pierre Wendling [mailto:pwendling at sopragroup.com] 
>>Sent: Thursday, November 28, 2002 2:02 PM
>>To: linux-poweredge at dell.com
>>Subject: running afacli in a cron job
>>
>>
>>Hi,
>>
>>Test config is a PE2500, PERC 3/Di, running RedHat 7.3 with 
>>afaapps-2.6-1 installed
>>
>>I have a perl script that calls afacli, send commands on it's 
>>stdin and 
>>parse the output. Everything works fine when called from a 
>>shell script 
>>launched from an interactive shell (i.e. with a tty), but as 
>>soon as I 
>>try to call it from the same shell script submitted as a 
>>cron/at job, it 
>>fails with the following message in the log:
>>
>>Error opening terminal: unknown
>>
>>I guess that's because afacli tries to use fancy tty features 
>>for it's CLI.
>>
>>However, I need to monitor the status of the RAID volumes and 
>>individual 
>>disks for multiple remote systems, and feed that into our monitoring 
>>framework. So I tried every possible way of calling afacli I 
>>could think 
>>of (shell script, perl, pipes, redirections, etc.) and 
>>couldn't find a 
>>way to run my script from cron.
>>
>>I tried to do something as close as I could to the example on Matt 
>>Domsch page, and I can not see how it could possibly work !
>>
>>Has anybody tried to do that ?
>>Would it be possible to get something more in the Unix spirit than 
>>afacli ? Like something that doesnt do stupid things with the tty but 
>>just reads and executes commands so that you can use it in scripts ???
>>
>>TIA
>>Pierre Wendling
>>Sopra Group, Annecy, France
>>
>>_______________________________________________
>>Linux-PowerEdge mailing list
>>Linux-PowerEdge at dell.com
>>http://lists.us.dell.com/mailman/listinfo/linux-poweredge
>>Please read the FAQ at http://lists.us.dell.com/faq or search 
>>the list archives at http://lists.us.dell.com/htdig/
>>
> 
> 
> _______________________________________________
> Linux-PowerEdge mailing list
> Linux-PowerEdge at dell.com
> http://lists.us.dell.com/mailman/listinfo/linux-poweredge
> Please read the FAQ at http://lists.us.dell.com/faq or search the list archives at http://lists.us.dell.com/htdig/
> 




More information about the Linux-PowerEdge mailing list