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

Perl scrip won't work in crontab

Expand Messages
  • Dukelow, Don
    I m running Solaris 10 and my Perl script won t work under crontab. Well part of it does anyway. I m making a file with headers in it and that part works
    Message 1 of 9 , Feb 25, 2009
    • 0 Attachment
      I'm running Solaris 10 and my Perl script won't work under crontab. Well part of it does anyway. I'm making a file with headers in it and that part works because I use a separate sub program to make the headers. But the rest of the program doesn't work. Which cycles around the network gathering up information. But when I run the program manually it works fine. Just not in cron! Does anyone have any ideas?
      -----
      Don Dukelow
      HP/GM GSC33 License Team
      e-mail: dukelow@...
    • Peter L. Berghold
      ... First question I m gonna ask as a follow up is what error(s) are you seeing? -- Peter L. Berghold http://www.berghold.net peter@berghold.net Unix
      Message 2 of 9 , Feb 25, 2009
      • 0 Attachment
        On Wed, 2009-02-25 at 16:36 +0000, Dukelow, Don wrote:
        > around the network gathering up information. But when I run the
        > program manually it works fine. Just not in cron! Does anyone have
        > any ideas?


        First question I'm gonna ask as a follow up is what error(s) are you
        seeing?


        --

        Peter L. Berghold http://www.berghold.net peter@...
        Unix Professional Dog Agility Fan Crazed Cook
        "Those who fail to learn from history are condemned to repeat it."
      • Dukelow, Don
        No errors! it just doesn t happened. ... Don Dukelow HP/GM GSC33 License Team e-mail: dukelow@hp.com ________________________________ From:
        Message 3 of 9 , Feb 25, 2009
        • 0 Attachment
          No errors! it just doesn't happened.


          -----
          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 11:43 AM
          To: perl-beginner@yahoogroups.com
          Subject: Re: [PBML] Perl scrip won't work in crontab


          On Wed, 2009-02-25 at 16:36 +0000, Dukelow, Don wrote:
          > around the network gathering up information. But when I run the
          > program manually it works fine. Just not in cron! Does anyone have
          > any ideas?

          First question I'm gonna ask as a follow up is what error(s) are you
          seeing?

          --

          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]
        • Peter L. Berghold
          ... Let me ask a different way. What is not happening when you run the script from cron? Is there an interactive portion of the process that is not being
          Message 4 of 9 , Feb 25, 2009
          • 0 Attachment
            On Wed, 2009-02-25 at 16:44 +0000, Dukelow, Don wrote:
            > No errors! it just doesn't happened.
            >
            Let me ask a different way.

            What is not happening when you run the script from cron? Is there an
            interactive portion of the process that is not being fulfilled? Is there
            a difference in the PATH under cron as there is when you run the script
            interactively? Are you running under cron with the same effective and
            real userid as you are interactively?


            >
            --

            Peter L. Berghold http://www.berghold.net peter@...
            Unix Professional Dog Agility Fan Crazed Cook
            "Those who fail to learn from history are condemned to repeat it."
          • Dukelow, Don
            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
            Message 5 of 9 , Feb 25, 2009
            • 0 Attachment
              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.
              When I run the script manually I just type the command in and let the $PATH variable find it. Under cron I give the absolute path to the command. There are no other copies of the command on the system.
              I'm login as a user not root and I have cron access for myself.
              I an running other Perl scripts in cron just fine and the permissions on the scripts is 750.
              The only other thing I can thing of is the scriptions needs one of three options to run like "-w". Would I have to quote that somehow in crontab to work. If its not there it gives a usage message and quits, but it can't be that because I'm still getting the header information.

              -----
              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 11:50 AM
              To: perl-beginner@yahoogroups.com
              Subject: RE: [PBML] Perl scrip won't work in crontab


              On Wed, 2009-02-25 at 16:44 +0000, Dukelow, Don wrote:
              > No errors! it just doesn't happened.
              >
              Let me ask a different way.

              What is not happening when you run the script from cron? Is there an
              interactive portion of the process that is not being fulfilled? Is there
              a difference in the PATH under cron as there is when you run the script
              interactively? Are you running under cron with the same effective and
              real userid as you are interactively?

              >
              --

              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]
            • mrkcoconnell
              Hi, The symptoms make this sound like a permission problem. You may not be accessig a directory when this runs under cron. Kevin ... crontab. Well part of it
              Message 6 of 9 , Feb 25, 2009
              • 0 Attachment
                Hi,
                The symptoms make this sound like a permission problem. You may not
                be accessig a directory when this runs under cron.
                Kevin

                --- In perl-beginner@yahoogroups.com, "Dukelow, Don" <dukelow@...>
                wrote:
                >
                >
                > I'm running Solaris 10 and my Perl script won't work under
                crontab. Well part of it does anyway. I'm making a file with
                headers in it and that part works because I use a separate sub
                program to make the headers. But the rest of the program doesn't
                work. Which cycles around the network gathering up information.
                But when I run the program manually it works fine. Just not in
                cron! Does anyone have any ideas?
                > -----
                > Don Dukelow
                > HP/GM GSC33 License Team
                > e-mail: dukelow@...
                >
              • Peter L. Berghold
                ... 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
                Message 7 of 9 , Feb 25, 2009
                • 0 Attachment
                  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@...
                  Unix Professional Dog Agility Fan Crazed Cook
                  "Those who fail to learn from history are condemned to repeat it."
                • 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 8 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 9 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.