Loading ...
Sorry, an error occurred while loading the content.
 

Re: Script hangs after getting 22 lines ot data...

Expand Messages
  • Greg
    Could this be the bahavior of the Net::SSH module? Has anyone experienced this?? ...
    Message 1 of 2 , Oct 11, 2007
      Could this be the bahavior of the Net::SSH module? Has anyone
      experienced this??

      --- In perl-beginner@yahoogroups.com, "Greg" <ggarri2910@...> wrote:
      >
      > Hey Gang-
      >
      > I can't seem to figure this out. This script used to work when I ran
      > it on an old machine. This was several years ago however. I can't
      > think of what may have changed unless it was something that was
      > updated within PERL.
      >
      > When I run it, it hangs after it gathers 22 lines of data. Crazy!
      >
      > Any thoughts?
      >
      >
      > #!/usr/bin/perl
      >
      >
      #===============================================================================
      > #
      > # Use this PERL script to add previous backup data to the backup.log
      file.
      > #
      > #
      > # change the following values..
      > #
      > # $xstamp the starting day's date (YYYY-MM-DD format)
      > # $stamp today's date (YYYY-MM-DD format)
      > # NOTE: Use yesterday's date if you plan on running
      > backuphist.pl
      > #
      >
      #===============================================================================
      >
      > $xstamp = "2007-09-06";
      > $stamp = "2007-10-06";
      >
      > #use lib "/usr/local/tsm/modules";
      > use Net::SSH qw(sshopen2);
      > use Time::Local;
      > # use strict;
      >
      > my $date=`/bin/date`;
      > chop $date;
      > my $user = "root";
      >
      > my $cmd = "dsmadmc -comma -id=myuserid -password=mypassword \"select
      > a.scheduled_start, \
      > a.node_name, b.platform_name, a.status from events a, nodes b \
      > where a.node_name = b.node_name \
      > and (a.scheduled_start>='$xstamp 19:00' \
      > and a.scheduled_start<='$stamp 07:00')\"\n";
      >
      >
      > my @HostArray;
      > open(HOSTS, "/usr/local/tsm/Hosts2Report.txt") ||
      > die "Could not open Hosts2Report.txt $! $?\n";
      > chop(@HostArray=<HOSTS>);
      > close(HOSTS);
      >
      > my $host;
      > foreach $host (@HostArray) {
      >
      > print "Connecting to: $host\n";
      > sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die
      > "ssh: $!";
      >
      > LINE: while(<READER>) {
      > chomp;
      >
      > print "$_\n";
      >
      > if(/^20/) {
      > my ($date,$node,$platform,$status) = split(/,/);
      >
      > # Log It
      > open(LOG, ">>/usr/local/tsm/backup.log") || die "Could not
      > open backup.log\n";
      > print LOG "$date,$node,$platform,$status\n";
      > # print "$date,$node,$platform,$status\n";
      > close(LOG);
      >
      > }
      > } # end foreach
      >
      > }
      >
      > print "\nOPERATION COMPLETE\n\n";
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.