Announcement

Collapse
No announcement yet.

Shell in CGI causing zombie processes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Shawn Anderson
    replied
    Usefull. Thanks Mike.

    Leave a comment:


  • Albert Richheimer
    replied
    Originally posted by Mike Doty View Post
    This allows running a program anywhere and optionally displaying a page before routing.
    This is what I am usually using to hand over control. But in the special case of my "shell problem" I didn't think of that solution. Are there any advantages (other than using the delay) over the "Location" construct?

    Originally posted by Mike Doty View Post
    This will run another program in the background.
    Neat. Thanks!

    Cheers
    Albert

    Leave a comment:


  • Mike Doty
    replied
    This will run another program in the background.
    Code:
    #INCLUDE "pbcgi.inc"
    FUNCTION PBMAIN() AS LONG
      WriteCgi "Test1.exe"
      WriteCgi "<img src='/cgi-bin/background.exe' height='0' align='right'>"
      WriteCgi "Processing in the background ..."
    END FUNCTION
    Last edited by Mike Doty; 5 May 2009, 05:24 AM.

    Leave a comment:


  • Mike Doty
    replied
    This allows running a program anywhere and optionally displaying a page before routing.
    Code:
    #INCLUDE "pbcgi.inc"
    FUNCTION PBMAIN() AS LONG
      WriteCgi  "Test1.exe waiting 1-second"
      WriteCGI  "<meta http-equiv='refresh' content='1;url=test2.exe'>"
    END FUNCTION

    Leave a comment:


  • Albert Richheimer
    replied
    Originally posted by Mike Doty View Post
    Does this work?
    Code:
    FUNCTION PBMAIN() AS LONG
      STDOUT CHR$("LOCATION: test2.exe",$CRLF)
    END FUNCTION
    Mike, you are a genius! This works perfectly. Why didn't I think of this?

    This method combines all advantages:
    • It circumvents the issue with httpd servers that don't accept shell
    • No need to load another large code chunk (CMD.EXE)
    • The memory that the dispatcher programm needs is freed as soon as the work module is loaded

    Thanks you so much!

    Cheers
    Albert

    Leave a comment:


  • Mike Doty
    replied
    Does this work?
    Code:
    FUNCTION PBMAIN() AS LONG
      STDOUT CHR$("LOCATION: test2.exe",$CRLF)
    END FUNCTION

    Leave a comment:


  • Mike Doty
    replied
    Shell works fine with Abyss.
    It returns incomplete set of headers with IIS/6.0

    I know it can be done so will try some things and get back.
    Last edited by Mike Doty; 4 May 2009, 11:56 PM.

    Leave a comment:


  • Shawn Anderson
    replied
    I don't think you can use shell.
    try
    Code:
    SHELL(ENVIRON$("COMSPEC") + " /C test.exe"

    Leave a comment:


  • Albert Richheimer
    started a topic Shell in CGI causing zombie processes

    Shell in CGI causing zombie processes

    Hello all

    After creating a (real large) CGI application I am considering to split it up into specialized tasks in order to enhance speed & efficiency. As usual I am using tiny code snippets to test the viability of my ideas. And I am failing at the very first step.

    The main idea is to have a small CGI working as a dispatcher, gathering the GET or POST data, putting it somewhere and selectively shelling out to the chunk that does the real work. I am failing with PB's shell function:
    HTML calling test1.exe:
    Code:
    #compile exe
    #dim all
    function pbmain() as long
        shell "test2.exe"
    end function
    The second program test2.exe:
    Code:
    #compile exe
    #dim all
    function pbmain() as long
        stdout "Content-type: text/html"
        stdout ""
        stdout "<html>"
        stdout "<head>"
        stdout "</head>"
        stdout "<body>"
        stdout "Here I should appear!<br>"
        stdout "</body>"
        stdout "</html>"
        stdout ""
    end function
    Looks simple, is simple, but creates two zombies "test1.exe" and "test2.exe" in the server's process list, that can't be terminated. I have to restart the server. BTW, I am using Apache 2.02. Any ideas what I am doing wrong?

    Cheers
    Albert
    Last edited by Albert Richheimer; 4 May 2009, 11:17 AM.
Working...
X