[comp.sys.ncr] Bug in batch ?

nigel@cnw01.storesys.coles.oz.au (Nigel Harwood) (08/06/90)

I am experiencing a strange problem with jobs being run using
batch.

Firstly, the environment is Tower 32/600 1.03, Tower 32/650 2.01.

The order of invocation is :

login
	script1.sh
      LPI COBOL
         script2.sh
            script3.sh
               batch
                  LPI run command

Script1.sh is the signon script which starts a menu application
written in LPI COBOL.

The user makes a selection which starts script2.sh.

Script2.sh runs a few COBOL programs and then runs script3.sh.

Script3.sh consists only of a batch command with a here document.

#/bin/sh
#
batch 1> /dev/null 2>&1 <<!
lpirun $ABC/program 1>xyz 2>&1 >xyz
!
exit 0

The variable ABC contains "/usr/acct/abcde/bin".

What happens is that every now and then I get a mail message from
cron saying "lpirun </usr/acct/abcde/b> not found [2]".

Looking into the programs being run I have found that its not
just one particular program, also re-running the program will
produce a successful run.

Certainly the re-directing of stdout twice is rather a strange
thing for the developer to do, but why should it cause an
intermittant problem.

I tried it here and it doesn't seem to mind.

I am also fairly satisified that the variable ABC is set correctly
when the command is expanded by the shell in the here document.

Also :

   o 99% of the systems reporting the error are the 2.01 systems.

   o Why should I get mail if the stdout/stderr are re-directed,
     sounds suspicious ?
-- 
<<<<<<<<<<<<<<<<<<<<<<<<<  Nigel Harwood  >>>>>>>>>>>>>>>>>>>>>>>>>>>
<< Post:  Coles Myer Ltd, PO Box 2000 Tooronga 3146, Australia     >>
<< Phone: +61 3 829 6090  E-mail: nigel@cnw01.storesys.coles.oz.au >>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

wescott@Columbia.NCR.COM (Mike Wescott) (08/07/90)

In article <1036@cnw01.storesys.coles.oz.au> nigel@cnw01.storesys.coles.oz.au (Nigel Harwood) writes:
> I am experiencing a strange problem with jobs being run using
> batch.

We have seen intermittent problems of batch jobs not running.  Difficult
to reproduce and debug.  Seems to have gone away in SysVr3 based releases.

> #/bin/sh
> #
> batch 1> /dev/null 2>&1 <<!
> lpirun $ABC/program 1>xyz 2>&1 >xyz
> !
> exit 0

> What happens is that every now and then I get a mail message from
> cron saying "lpirun </usr/acct/abcde/b> not found [2]".

If the file xyz has been created then the message is coming from
lpirun.  If not then the shell is having trouble finding lpirun
or the script has been botched.  You can find the script that cron
sees in /usr/spool/cron/atjobs.

>    o Why should I get mail if the stdout/stderr are re-directed,
>      sounds suspicious ?

When cron runs, it starts up a shell to handle the script, saving the
stdout/stderr and mailing it to the user.  All that's been redirected
to /dev/null is the output from /usr/bin/batch, and not the script
that runs under cron.
--
	-Mike Wescott
	 mike.wescott@ncrcae.Columbia.NCR.COM