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

Re: Another system command question - URL vs. command line

Expand Messages
  • dougawells@yahoo.com
    I think the problem that you are seeing is that when you run this system call from the URL, it is completing successfully. The system call that is, not
    Message 1 of 6 , Mar 1, 2001
      I think the problem that you are seeing is that when you run this
      system call from the URL, it is completing successfully. The system
      call that is, not necessarily the program you are calling
      (getasset_product). When you run it from a command line, you are
      actully seeing the exit status of the program.

      Are you able to change the program getasset_product? If so, maybe you
      could do a 'touch fail.flag' or some sort of indicator if it is
      unsuccessful, then have your Perl program check for the existence of
      this file. If it is there, you failed, if it is not there, you were
      successful. Not the most elegant solution, but it should work.
      (Remember to delete this flag file before closing out your program).

      Hope this helps.
      Doug

      --- In perl-beginner@y..., "Gail Buffington" <gbuffing@k...> wrote:
      > I am running the following perl script:
      >
      >
      > $ENV{'ORACLE_SID'}='cml1';
      > $ENV{'progsdir'}='/d01/app/oracle/xferweb';
      > $ENV{'ORACLE_HOME'}='/d01/app/oracle/product/8i_816';
      > $ENV{'PATH'}
      > ='/d01/app/oracle/product/8.0.5/ows/4.0/../cartx/common/perl/bin:
      > .:/usr/ccs/bin:/usr/X/bin:/usr/openwin/bin:/usr/bin/X11:/usr/sbin:/u
      sr
      > /bin:/usr/
      >
      ucb:/opt/local/bin:/d01/app/oracle/product/8i_816/bin:/d01/app/oracle/
      > product/8i
      > _816/ctx/bin:/d01/app/oracle/xferweb';
      > $exit_abc="test";
      > $exit_status=system('getasset_product r > /dev/null');
      > print "Content-type: text/html\n\n";
      > print "<html>\n";
      > print "<head>\n";
      > print "<title>Transfer to review</title>\n";
      > print "</head>\n";
      > print "<body bgcolor=\"#FFE4E1\">\n";
      > if ($exit_status == 0)
      > { print "<p>Transfer To Review Complete!<p>"; }
      > else
      > { print "<p>Problem Transferring To Review!<p>"; }
      > printf("status %s\n",$exit_status);
      > printf("abc status %s\n",$exit_abc);
      > print "</body></html>\n";
      >
      >
      > I do an "exit 0" from getasset_product if getasset_product has run
      > correctly, and an "exit 50" from getasset_product if there were
      > problems.
      >
      > On the command line, the variable $exit_status is set to either 0
      > if the process ran correctly, and a non-zero value otherwise. When
      I
      > run this from a URL, using Oracle Application WebServer, the
      > $exit_status variable is not set from the system command. Even if I
      > substitute a system command like
      >
      > $exit_status=system("xxxwww"); - an invalid command, the exit
      status
      > is set properly from the command line, but improperly through a URL.
      >
      > Any ideas? I am totally stumped by this one.
      >
      > Thanks for your help!
      >
      > Gail Buffington
      > Web Developer
      > Keithley Instruments
    • Damien Carbery
      From a quick read of the docs on system(), it says that system() ... child processes. The status is returned in $?. One example in the docs demonstrates
      Message 2 of 6 , Mar 1, 2001
        From a quick read of the docs on system(), it says that system()
        returns:
        > the exit status of the program as returned by the wait call.
        > To get the actual exit value divide by 256.
        And wait:
        > returns the pid of the deceased process, or -1 if there are no
        child processes. The status is returned in $?.

        One example in the docs demonstrates getting the actual exit value:
        $exit_value = $? >> 8;

        --- In perl-beginner@y..., dougawells@y... wrote:
        > I think the problem that you are seeing is that when you run this
        > system call from the URL, it is completing successfully. The system
        > call that is, not necessarily the program you are calling
        > (getasset_product). When you run it from a command line, you are
        > actully seeing the exit status of the program.
        >
        > Are you able to change the program getasset_product? If so, maybe
        you
        > could do a 'touch fail.flag' or some sort of indicator if it is
        > unsuccessful, then have your Perl program check for the existence of
        > this file. If it is there, you failed, if it is not there, you were
        > successful. Not the most elegant solution, but it should work.
        > (Remember to delete this flag file before closing out your program).
        >
        > Hope this helps.
        > Doug
        >
        > --- In perl-beginner@y..., "Gail Buffington" <gbuffing@k...> wrote:
        > > I am running the following perl script:
        > >
        > >
        > > $ENV{'ORACLE_SID'}='cml1';
        > > $ENV{'progsdir'}='/d01/app/oracle/xferweb';
        > > $ENV{'ORACLE_HOME'}='/d01/app/oracle/product/8i_816';
        > > $ENV{'PATH'}
        > > ='/d01/app/oracle/product/8.0.5/ows/4.0/../cartx/common/perl/bin:
        > >
        .:/usr/ccs/bin:/usr/X/bin:/usr/openwin/bin:/usr/bin/X11:/usr/sbin:/u
        > sr
        > > /bin:/usr/
        > >
        >
        ucb:/opt/local/bin:/d01/app/oracle/product/8i_816/bin:/d01/app/oracle/
        > > product/8i
        > > _816/ctx/bin:/d01/app/oracle/xferweb';
        > > $exit_abc="test";
        > > $exit_status=system('getasset_product r > /dev/null');
        > > print "Content-type: text/html\n\n";
        > > print "<html>\n";
        > > print "<head>\n";
        > > print "<title>Transfer to review</title>\n";
        > > print "</head>\n";
        > > print "<body bgcolor=\"#FFE4E1\">\n";
        > > if ($exit_status == 0)
        > > { print "<p>Transfer To Review Complete!<p>"; }
        > > else
        > > { print "<p>Problem Transferring To Review!<p>"; }
        > > printf("status %s\n",$exit_status);
        > > printf("abc status %s\n",$exit_abc);
        > > print "</body></html>\n";
        > >
        > >
        > > I do an "exit 0" from getasset_product if getasset_product has run
        > > correctly, and an "exit 50" from getasset_product if there were
        > > problems.
        > >
        > > On the command line, the variable $exit_status is set to either 0
        > > if the process ran correctly, and a non-zero value otherwise. When
        > I
        > > run this from a URL, using Oracle Application WebServer, the
        > > $exit_status variable is not set from the system command. Even if
        I
        > > substitute a system command like
        > >
        > > $exit_status=system("xxxwww"); - an invalid command, the exit
        > status
        > > is set properly from the command line, but improperly through a
        URL.
        > >
        > > Any ideas? I am totally stumped by this one.
        > >
        > > Thanks for your help!
        > >
        > > Gail Buffington
        > > Web Developer
        > > Keithley Instruments
      • Gail Buffington
        Hello Doug, Thank you for your response - I am going to try this. Gail ... you ... of
        Message 3 of 6 , Mar 2, 2001
          Hello Doug,

          Thank you for your response - I am going to try this.

          Gail
          --- In perl-beginner@y..., dougawells@y... wrote:
          > I think the problem that you are seeing is that when you run this
          > system call from the URL, it is completing successfully. The system
          > call that is, not necessarily the program you are calling
          > (getasset_product). When you run it from a command line, you are
          > actully seeing the exit status of the program.
          >
          > Are you able to change the program getasset_product? If so, maybe
          you
          > could do a 'touch fail.flag' or some sort of indicator if it is
          > unsuccessful, then have your Perl program check for the existence
          of
          > this file. If it is there, you failed, if it is not there, you were
          > successful. Not the most elegant solution, but it should work.
          > (Remember to delete this flag file before closing out your program).
          >
          > Hope this helps.
          > Doug
        • Gail Buffington
          Hello Damien. Thank you for your response. I am going to look into this. Gail
          Message 4 of 6 , Mar 2, 2001
            Hello Damien.

            Thank you for your response. I am going to look into this.

            Gail
            --- In perl-beginner@y..., "Damien Carbery" <daymobrew@y...> wrote:
            > From a quick read of the docs on system(), it says that system()
            > returns:
            > > the exit status of the program as returned by the wait call.
            > > To get the actual exit value divide by 256.
            > And wait:
            > > returns the pid of the deceased process, or -1 if there are no
            > child processes. The status is returned in $?.
            >
            > One example in the docs demonstrates getting the actual exit value:
            > $exit_value = $? >> 8;
          • Damien Carbery
            Today s (Friday 2nd) Perl.com Recipe of the Day talks about running external programs. It is from Perl Cookbook
            Message 5 of 6 , Mar 2, 2001
              Today's (Friday 2nd) Perl.com Recipe of the Day talks about running
              external programs. It is from "Perl Cookbook"
              http://www.perl.com/pub/universal/pcb/solution.html

              It describes the use of system() and says that "rhe returned status
              value is not just the exit value: it includes the signal number (if
              any) that the process died from."

              It also goes into shell metacharacter expansion.

              --- In perl-beginner@y..., "Gail Buffington" <gbuffing@k...> wrote:
              > Hello Damien.
              >
              > Thank you for your response. I am going to look into this.
              >
              > Gail
              > --- In perl-beginner@y..., "Damien Carbery" <daymobrew@y...> wrote:
              > > From a quick read of the docs on system(), it says that system()
              > > returns:
              > > > the exit status of the program as returned by the wait call.
              > > > To get the actual exit value divide by 256.
              > > And wait:
              > > > returns the pid of the deceased process, or -1 if there are no
              > > child processes. The status is returned in $?.
              > >
              > > One example in the docs demonstrates getting the actual exit
              value:
              > > $exit_value = $? >> 8;
            Your message has been successfully submitted and would be delivered to recipients shortly.