in reply to run a background process

Since you fork in the first place, why not exec as well, rather than system?!?

Replies are listed 'Best First'.
Re^2: run a background process
by Anonymous Monk on Jul 14, 2005 at 10:33 UTC
    tried that already.

    It seems to work well when running from the terminal, but if run from cgi, there's still no response, and 'ps x' shows a zombie process:
    [script.pl] <defunct>

      Then smell of XY here: (nearly) no experience with cgi myself, but do you really want your cgi process to fork a background running task and then exit?

      Maybe giving a peek into perlipc may give you some ideas about other ways to accomplish what you're really after...

        The thing is: I run a mud, and lately the server has been rebooting every few days. The server admin won't add my mud to the crontab or something to make it start along with the server, so I devised this, to allow any of my players to startup the mud in these cases.

        Now a single click can launch the game. Of course, it will check whether the game is already running (and some other things) to prevent abuse.