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

RE: [PBML] Perl scrip won't work in crontab

Expand Messages
  • Dukelow, Don
    What I mean by run around the network is. I have a list of servers and i use Net::SSH::Perl to SH into each one and do ifconfig s and kstat to gather port
    Message 1 of 9 , Feb 25, 2009
    • 0 Attachment
      What I mean by run around the network is. I have a list of servers and i use Net::SSH::Perl to SH into each one and do ifconfig's and kstat to gather port settings.

      Give me awhile and I.'ll set it up to get the %ENV data.


      -----
      Don Dukelow
      HP/GM GSC33 License Team
      e-mail: dukelow@...



      ________________________________
      From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Peter L. Berghold
      Sent: Wednesday, February 25, 2009 12:33 PM
      To: perl-beginner@yahoogroups.com
      Subject: RE: [PBML] Perl scrip won't work in crontab


      On Wed, 2009-02-25 at 17:11 +0000, Dukelow, Don wrote:
      > When run manually the script makes three forks, runs around the network gathering server port information. Then I make the file with the header information in it, then combine all three port information files together and put them all in the file with the header. When run under cron I only get the header file, the rest of the data isn't there. When run manually it takes about 10 minutes but under cron it takes the time to make the header file and quits.
      > There is no interaction part in script.

      OK: what does "runs around the network" mean? What is being invoked?

      What I'm trying to help you discover is what is the difference in the
      environment under cron as opposed to when you run interactively from the
      shell?

      My first instincts tell me this is not purely a Perl issue per se.

      Part of how I would trouble shoot this if it were me would be to put
      logic into the the three child processes that logs into a file the
      contents of %ENV to help determine what is going on here.

      <code>
      #
      # much hand waving
      #
      # under my child process
      open FOO,sprintf("> /tmp/env-vars.%d.txt",$$) or die $!;
      foreach my $key(keys %ENV){
      printf FOO "%s = \"%s\"\n",$key,$ENV{$key};
      }
      close FOO
      </code>

      That should give you a leg up on what is happening.

      >
      --

      Peter L. Berghold http://www.berghold.net peter@...<mailto:peter%40berghold.net>
      Unix Professional Dog Agility Fan Crazed Cook
      "Those who fail to learn from history are condemned to repeat it."





      [Non-text portions of this message have been removed]
    • Dukelow, Don
      Sorry it took so long but they expect me to do work around here for some stranfe reasion. The to attachments is the output of the %ENV hash running the scrips
      Message 2 of 9 , Feb 26, 2009
      • 0 Attachment
        Sorry it took so long but they expect me to do work around here for some stranfe reasion.

        The to attachments is the output of the %ENV hash running the scrips manually and through cron. Your right the script looses alot in cron. So what is the best way to fix this.

        I also noticed that this only affects the Perl scripts that use Perl SSH to log into other servers, telnet works fine.

        -----
        Don Dukelow
        HP/GM GSC33 License Team
        e-mail: dukelow@...



        ________________________________
        From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com] On Behalf Of Peter L. Berghold
        Sent: Wednesday, February 25, 2009 12:33 PM
        To: perl-beginner@yahoogroups.com
        Subject: RE: [PBML] Perl scrip won't work in crontab


        On Wed, 2009-02-25 at 17:11 +0000, Dukelow, Don wrote:
        > When run manually the script makes three forks, runs around the network gathering server port information. Then I make the file with the header information in it, then combine all three port information files together and put them all in the file with the header. When run under cron I only get the header file, the rest of the data isn't there. When run manually it takes about 10 minutes but under cron it takes the time to make the header file and quits.
        > There is no interaction part in script.

        OK: what does "runs around the network" mean? What is being invoked?

        What I'm trying to help you discover is what is the difference in the
        environment under cron as opposed to when you run interactively from the
        shell?

        My first instincts tell me this is not purely a Perl issue per se.

        Part of how I would trouble shoot this if it were me would be to put
        logic into the the three child processes that logs into a file the
        contents of %ENV to help determine what is going on here.

        <code>
        #
        # much hand waving
        #
        # under my child process
        open FOO,sprintf("> /tmp/env-vars.%d.txt",$$) or die $!;
        foreach my $key(keys %ENV){
        printf FOO "%s = \"%s\"\n",$key,$ENV{$key};
        }
        close FOO
        </code>

        That should give you a leg up on what is happening.

        >
        --

        Peter L. Berghold http://www.berghold.net peter@...<mailto:peter%40berghold.net>
        Unix Professional Dog Agility Fan Crazed Cook
        "Those who fail to learn from history are condemned to repeat it."





        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.