Ok, have you try to include your Glob in DBFTP.PL
and of course DBFTP could launch the finally task (compress ?)

Yves.

-----Original Message-----
From: Rajee Gopinath [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 23, 2002 8:46 AM
To: Dutrieux Yves <YDU
Cc: [EMAIL PROTECTED]
Subject: RE: Help on Win32::Process



Yves,

Using backtick is simillar to using system I think.

Neverthless, I do want to the calling program to wait, but only after the
DBFTP.pl has been called as many times
as are the number of files returned by the @FTPfiles.

ie, if @FTPFiles contain a.dbf, b.dbf, c.dbf, e.dbf, f.dbf then, I want the
program to execute DBFTP.pl for all the
5 dbf files and then wait instead of waiting after executing DBFTP.pl one
by one (sequentially).

The idea here is to save time by ftp'ing all the 5 files parellely and save
time.

I'm able to FTP file 5 files parellely allright. But I dont know how to
wait till all the 5 files are FTP'ed.

Suppose, if I get the PID using GetProcessID(), is there a way to findout
of the status of these PIDs.

Thanks,
rgn





 

                      Dutrieux Yves

                      <[EMAIL PROTECTED]>             To:       'Rajee Gopinath'
<[EMAIL PROTECTED]>                              
                                               cc:

                      12/23/2002 02:20         Subject:  RE: Help on
Win32::Process                                                   
                      AM

 

 





Why not use backticks instead of win32::process, so your perl will waiting
for your DBFTP.PL before process the next line.
Also, I think that an error with string "550" would be produced by an ftp
session.

Yves.

-----Original Message-----
From: Rajee Gopinath [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 23, 2002 7:04 AM
To: [EMAIL PROTECTED]
Subject: Help on Win32::Process



Hello All,

I was trying to write this perl program and got stuck with it. Basically,
this program does the following

[1] Get the list of files from the dir that matches the file search
[2] Builds a string and calls another perl program (DBFTP.pl) which then
FTPs the file.
[3] Repeats [2] for each of the matching files .
[4] Does something else based on the completion of the FTP. If it is
successfull, it starts a uncompress
process, if it fails, it emails the admins. This step is yet to be
implemented.

The problem is that, the program loops thru the list of files and starts
the FTP process and exits. But this
wont tell me when the DBFTP.pl completes the FTP of all the files. For me
this is necessary because after
the successfull completion of the FTP of the files, I will have to start a
another process (Uncompress and
Restore process).

The documentation for Win32::Process is pretty vague, I think and I would
very much appreciate if someone
could help me with a sample script.

My question is :
[1] Even if I were to FTP just one file, how do I check the completion of
the process ?
[2] How do I repeat this for all the processes created ?
[3] What does Winn32::Process::Open($obj,$pid,$iflags) do ?

Thanks,
rgn

use File::Path;
use File::Basename;
use Win32;
use Win32::Process;

$ftpserver = " USFTPServer";
$uid = " upload";
$pwd = " upload";
$folder = " Cologne ";

@FTPFiles = glob("F:\\TAPEBACKUP\\401k.r*");

foreach $count(@FTPFiles) {

$putfile = $count;
$subject = " " .$count . "->FTPDone";
$logfile = outputfile($putfile,$putfile);
$cmdline = "Perl DBFTP.pl " . $putfile . $ftpserver . $uid . $pwd . $folder
. $logfile . $subject;
print "Command Line : $cmdline\n";

Win32::Process::Create($ProcessObj,
"D:\\ActivePerl\\bin\\Perl.exe",
$cmdline,
0,
DETACHED_PROCESS,
".") || die &print_error;

$ProcessObj->Wait(DETACHED_PROCESS) || warn &print_error;

$ProcessObj->GetExitCode($ExitCode) || warn &print_error;

print "Exit Code is : $ExitCode\n";
}

sub print_error {
print Win32::FormatMessage(Win32::GetLastError() );
}

sub outputfile {
($outputfile,$extension) = split(/\./,$putfile);
$outputfile = $outputfile . ".log";
return $outputfile;
}

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to