in reply to Re: forking, no child waiting.
in thread forking, no child waiting.

You know, that has worked for me in the past, but not in this case, I have tried system() exec() and fpassthru(), and now recently pcntl_fork(). This perl scripts gets angry when php leaves it alone for some stupid reason. Another thing I am thinking might work for these situations, is to have the first script write a cron job to do the second script, and then the second script will always remove itself from any cron entries, but I am hoping for a simpler solution, if Perl can fork, or whatever.

Replies are listed 'Best First'.
Re: Re: Re: forking, no child waiting.
by suaveant (Parson) on Sep 20, 2001 at 21:13 UTC
    Hrm... yeah... try putting this in the perl script you are calling...
    fork && exit(); #background process close(STDOUT); close(STDERR); close(STDIN);
    see if that detaches it... now you should not need th > /dev/null &

                    - Ant
                    - Some of my best work - Fish Dinner

      Oh man,,,,

      I was all happy, and then I tried it, it worked great when running it from the prompt, but still just kind-of dies when done from the php app. I am hating this part! Here is where I am calling my perl script:
      $run="snmp-wdr -c mrtgtest $request &";<BR> echo "<BR>COMMAND SENT: $run<BR>";<BR> $setsys=system($run);<BR>
      DANG!

        In addition to the above, you may need to call setpgrp(). See "perldoc -q daemon" for a bit more information.

                - tye (but my friends call me "Tye")
        Well... you've got me...

                        - Ant
                        - Some of my best work - Fish Dinner