--- "Arante, Susan" <[EMAIL PROTECTED]> wrote:
> This used to be working but after my very adventurous fiasco
> (deleting perl5, installing perl6, deleting perl6, installing perl5 -
> yes i deleted not uninstalled), it's not working anymore.  I'm
running
> perl5 on NT.

I'd try installing Perl5, then uninstalling, then installing Perl6,
then uninstalling, then installing Perl6.
Hey, it could work, lol....

Sorry. I don't imagine you think it's very funny. =o)
But I really have had that sort of thing work.
 
> I'm getting the above error when my perl script runs a batch
> (master.bat)
> that in turn runs a batch (slave.bat) that runs another perl script.
>
> The process kicks me out 
 
What do you mean, "kicks me out"? Do you have any error reporting?

>-----------------------------------------------------------------------
> Script goes like this:
> open(CFGFILE, "ReStart_one.cfg"));

Two close parens?-----------------^

> open(MASTERBAT, ">Master.bat");

Add "or die" to each. 
 open CFGFILE, "ReStart_one.cfg" or die "ReStart_one.cfg: $!";
 open MASTERBAT, ">Master.bat" or die "Master.bat: $!";
 
> $mcname = <CFGFILE>; 
> while ($mcname ne "") {

Just since I can't see the rest of the script, is there a reason you
didn't just use
  while($mcname=<CFGFILE>) {

That would preinitialize before the first loop iteration, and would
fall out of the loop at EOF (when it returned undef). 
Also, in case you aren't, try these to help your error reporting:
  use strict;
  use diagnostics; enable diagnostics;

and run perl with the -w flag.

> chomp($mcname);
> printf MASTERBAT ("Start slave.bat $mcname\n");
> printf MASTERBAT ("wait 5\n");

Don't use printf unless you really need it. print is faster and more
stable, or so I seem to remember reading in the docs somewhere....yup.
>From perldoc -f printf:
 printf FILEHANDLE FORMAT, LIST
 printf FORMAT, LIST
     Equivalent to `print FILEHANDLE sprintf(FORMAT, LIST)', except
     that `$\' (the output record separator) is not appended.  The
     first argument of the list will be interpreted as the `printf'
     format.  If `use locale' is in effect, the character used for
     the decimal point in formatted real numbers is affected by the
     LC_NUMERIC locale.  See the perllocale manpage.
==>> Don't fall into the trap of using a `printf' when a simple
     `print' would do.  The `print' is more efficient and less
     error prone.
 
> NEXTMC:$mcname = <CFGFILE>;
> }
> close MASTERBAT;
> printf `master.bat`;

Check $? and $! after this runs:
  print "master.bat returned $? $!\n";

> --------------------------------------------------------------------
> Master.bat has these lines:
> Start slave.bat CHITMD03
> wait 5
> Start slave.bat CHITMD19
> wait 5
> Start slave.bat CHITMP03
> wait 5

Assuming these are DOS-ish, though I'm not familiar with batch commands
since about DOS6.2; I'm assuming Start is analogous to the call
command, which runs a batch file and arranges to return to the current
script afterwards (which wasn't the default last time I wrote a batch
file), or perhaps is NT's way of putting a script into the background?.
I also assume wait does what it does in UNIX, which is to wait (doh),
usually for a background process.

> -------------------------------------------------------------------
> Slave.bat calls a perl script that stops and starts certain services
> on the server.
> -------------------------------------------------------------------
> The whole process runs fine if I only have one machine listed in cfg.
>  It dies and kicks me out right before master.bat when I have more
> than one machine in cfg.  Any clues?  Btw, I removed some lines to
> simplify script (I may have chopped it too much!)...

Good luck.
 
> tia..
> Susan


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

Reply via email to