Hi
I have a Perl script that runs as CGI and uses Net::Telnet to connect to a
UNIX machine and execute a set of tasks. The system works except that the
user has to wait for the some time for the browser to show up something (it
waits till the control is returned from the Telnet process) . Part of the
code is as below.
Is there a better of way doing this so that user is not kept in suspense for
the duration of the processing?

Thanks 
Sundar

#############################
Code
############################

use strict;
use Net::Telnet;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $query = new CGI;
print $query->header;
print $query->start_html("Clean Up Servers.....");

my $ServerOS                 =  $query->param("OSType");
my $ServerName               =  $query->param("ServerName");


my $Username = "xxxxxxxx";
my $Password = "xxxxxxxxx";


&fCleanUpOldInstances($ServerName , $Username,$Password);


print $query->end_html;


sub fCleanUpOldInstances {
    
    my ($Host,$User,$Password) = @_ ;
    my $SiebProcFlag = 0;
    my $GtwyProcFlag = 0;
    my $SourceCmd = "source \/export\/home\/siebel\/siebsrvr\/siebenv.csh";
    my $GtwySourceCmd = "source
\/export\/home\/siebel\/gtwysrvr\/siebenv.csh";
    
    # Create a new object
    my $telnet = new Net::Telnet (
timeout=>240,Errmode=>'die',Prompt=>'/[\$%#>] $/');

    # Open connections and log in
    $telnet->open("$Host");
    #debug print "done\n";
    $telnet->login("$User", "$Password");
    
    # Check if the Siebel processes are running
    my @lines = $telnet->cmd("ps -ef | grep sieb");
    print "The outpuit of ps -ef | grep sieb is @lines\n<br>";
    
    foreach (@lines) {
        if (m/siebsvc -s siebsrvr/i) {
                print "Siebel Process - $_<br>\n"  ;             
               $SiebProcFlag = 1; 
        }
        
        if (m/siebsvc -s gtwyns/i) {
                print "bGateway Process - $_<br>\n"  ;
               $GtwyProcFlag = 1; 
        }    
         
    }
    
   
    
    # Delete directories
    $telnet->cmd("unalias rm");
    
    foreach(@DirToDelete) {    
        &DeleteDir($_,$telnet);
    }

    @lines = $telnet->cmd("ps -ef | grep sieb");
    print "<b>@lines\n</b><br>";
    
      
    
    
    $telnet->close("$Host");
    
   
    
}

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

Reply via email to