[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20030930: McIDAS - SGI IRIX - EXIT command from BATCH file



>From: "Jason Sippel" <address@hidden>
>Organization: Texas A&M
>Keywords: 200309302129.h8ULTXJn013884 McIDAS shell script

Jason,

>Institution: Texas A&M University
>Package Version: X7.1
>Operating System: SGI IRIX
>Hardware Information: unknown
>Inquiry: I\'m trying to run McIdas from a script that creates a batch file by 
> using the command:
>
>mcidas -c \'BATCH file.bat\'
>
>McIdas goes through the batch file without any problems until it hits the EXIT
>command at the end of the file.  The reply I get is: "EXIT NOT FOUND" and 
>the batch job is abandoned.
>
>I intend for this command to terminate McIdas once I'm done with all the
>other commands in the file, but McIdas apparently doesn't recognize this
>command when read in from a batch file.  
>
>Is this a bug, or is it designed to be this way?

There is actually no EXIT command in McIDAS.  Commands included in
a McIDAS BATCH file have to be primary McIDAS commands, ones in
~mcidas/bin (most have .k sufficies like imgdisp.k which is the actual
command for IMGDISP.

>In any case, is there a way around my problem?

Don't include the EXIT at the end of the BATCH file.  The McIDAS mini-session
will go away when all the commands have finished.

There is another way...

In current distributions of McIDAS (yous seem to be using a
distribution of McIDAS that is many years old; the current distribution
is v2003), I include two example Unix shell scripts that are designed
to run McIDAS commands:

mcbatch.sh
mcurn.sh

mcbatch.sh is setup to run McIDAS BATCH files.  mcrun.sh is setup to
run a series of McIDAS commands.  Both exit McIDAS at the end of 
invocation.

Since you are attempting to run a McIDAS BATCH file, I suggest using
mcbatch.sh:

- if McIDAS v7.1 has mcbatch.sh (I can't remember, and do not have this
  distribution installed anymore), then copy it to a local file in
  your account:

cp ~mcidas/data/mcbatch.sh ~/mybatch.sh

- if McIDAS v7.1 does not have mcbatch.sh, FTP it using anonymous FTP
  from the Unidata FTP server, ftp.unidata.ucar.edu:

cd ~
ftp ftp.unidata.ucar.edu
  <user> anonymous
  <pass> address@hidden
  cd pub/mcidas/data
  binary
  get mcbatch.sh mybatch.sh
  quit

Next, edit mybatch.sh and change things that may need changing:

MCHOME=          <- the HOME directory for the user 'mcidas'
MCLOG=           <- define to be a log file for McIDAS command text output
MCTABLE_READ=    <- semi colon separated list fully qualified names of
                    client routing tables
PATH=            <- normal PATH definition, but with ~mcidas/bin first
LD_LIBRARY_PATH= <- normal definition

mcbatch.sh is executed as follows:

mcbatch.sh file.bat

Let me know if you have questions about how to use mcbatch.sh.

>Thanks,

No worries.

Tom Yoksas

>From address@hidden Wed Oct  1 15:54:08 2003

Thanks for the help - FYI, I just wanted to let you know that the scripts 
are actually located in the following directory on the unidata site:

/pub/mcidas/bin/scripts

The script works great!

Thanks again,

Jason

>From address@hidden Mon Oct 13 13:39:26 2003

Support:

When I run Mcidas manually, I don't encounter this problem, and the temp 
dirs get removed. 

I have attached a copy of my .cshrc file as well as one version of the batch 
file I'm using as well as the script that creates the file.  The batch file 
changes automatically, depending on variables that are sent to it.  I have 
not attached the "parent" script that actually calls on mcbatch, but it 
actually invokes both the script that creates the batch file (which I have 
attached) and the mcbatch script... I think that sorta explains what I'm 
doing.

Here is the output from uname -a:

IRIX nimbus 6.5 01100303 IP22

If the problem is indeed related to the antiquity of our version of McIdas, 
there is a chance we may have a newer version installed on another group of 
machines (which are down attm), so I might soon know.

Thanks for your help!

Jason

Unidata Support <address@hidden> said:

> >From: "Sippel, Jason Allen" <address@hidden>
> >Organization: Texas A&M
> >Keywords: 200309302129.h8ULTXJn013884 McIDAS shell script
> 
> Jason,
> 
> >I have followed the below instructions, but am still having one problem 
with 
> >running the mcbatch.sh script.  
> >
> >Everything runs fine, but when the script exits, it does not remove the 
> >temporary files from the .mctmp directory.  
> 
> Are you sure that the temporary directories in ~/.mctmp that are being
> created by the script are not being removed?  Since it is possible that
> some other invocation is not removing them instead of the mcbatch.sh
> script, I just want to make sure that you are positive that the ones
> being left are from the script.
> 
> >I have noclobber set in my .cshrc file, and I tried unalias rm from the 
> >parent script, but that didn't seem to work.Can you pinpoint the source 
of 
> >this problem - and how to work around the noclobber setting if that 
indeed 
> >is the problem?
> 
> I just ran mcbatch.sh on our SGI IRIX 6.5 machine:
> 
> IRIX chevy 6.5 04091957 IP22
> 
> several times and do not see ~/.mctmp directories linger after the end
> of the shell script.  To try and replicate your environment, I set
> noclobber in my .cshrc file and add an alias for 'rm':
> 
> set noclobber
> alias rm '/bin/rm -i'
> 
> mybatch.sh TESTIT.BAT
> 
> The BATCH file I ran, TESTIT.BAT, is simple, but it the problem you are
> seeing shouldn't matter what is in the batch file.  Here is the
> contents of TESTIT.BAT:
> 
> DATALOC LIST
> DSINFO I RTIMAGES
> IMGLIST RTIMAGES/GE-IR.ALL
> 
> In order to help me see if I can replicate your problem, can you send me:
> 
> - output from 'uname -a'
> - the contents of your .cshrc file
> - a full listing of the McIDAS BATCH file you are running
> 
> I am concerned that your problem may be related to the extremely old
> version of McIDAS you are running (v7.1).
> 
> Tom
> 
**************************************************************************** 
<
> Unidata User Support                                    UCAR Unidata 
Program <
> (303)497-8643                                                  P.O. Box 
3000 <
> address@hidden                                   Boulder, CO 
80307 <
> ---------------------------------------------------------------------------
- <
> Unidata WWW Service              
http://my.unidata.ucar.edu/content/support  <
> 
**************************************************************************** 
<
> 



-- 





----------part3f8aff5e55f08
Content-Type: application/octet-stream; name=".cshrc"
Content-Transfer-Encoding: base64

IwojIFRoZSBjb21tYW5kcyBpbiB0aGlzIGZpbGUgYXJlIGV4ZWN1dGVkIGVhY2ggdGltZSBhIG5l
dyBjc2ggc2hlbGwKIyBpcyBzdGFydGVkLgojCiMgJFJldmlzaW9uOiAxLjcgJAojCgojIFJlbWVt
YmVyIGxhc3QgMTAwIGNvbW1hbmRzCnNldCBoaXN0b3J5ID0gMTAwCgpzZXRlbnYgUFdEIGBwd2Rg
CgojIEZvciBpbnRlcmFjdGl2ZSBzaGVsbHMsIHNldCB0aGUgcHJvbXB0IHRvIHNob3cgdGhlIGhv
c3QgbmFtZSBhbmQgZXZlbnQgbnVtYmVyLgppZiAoICQ/cHJvbXB0ICkgdGhlbgoJaWYgKCAtbyAv
YmluL3N1ICk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uMDUvMjM0NQo=




----------part3f8aff5e55f08--