0

How can I start a perl script from within a perl script but without being part of the same thread of execution. Like forking and letting the original script continue execution?
I think system does not do that as I see in the same console the output of the other script

16
  • @ChrisHawkes: There is no solution in those links to execute and not replace the current script. Or execute and not wait Commented Aug 18, 2017 at 14:17
  • For your second script, do you only want to run it unless a certain condition occurs, or is it something that always needs to run? Also, do you not want to see output at all for that second script? Commented Aug 18, 2017 at 16:08
  • @Cubis:I do not want to see any output of the second script. I just want to start it and continue/forget about it from the forking script point of view. And I want to run it in a specific area near the end of my first script Commented Aug 18, 2017 at 18:16
  • 1
    if you fork it, it returns 0 to the child process - with that, you can tell which process is the child, and have the child do a system call to your script and direct any output to /dev/null so it doesn't show any output on your console. Commented Aug 18, 2017 at 18:55
  • 1
    What I was trying to get at is that you can just put the wait() at the very end of your parent code. Your program was going to exit anyway at that point, so there's no real harm in your program waiting for the child to finish so it can clean up the zombie. However, check out this link that I saw today that doesn't even worry about waiting: it uses perl commands to turn off output before the child runs the exec: perlmonks.org/?node_id=1082332 Commented Aug 25, 2017 at 18:18

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.