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
-
@ChrisHawkes: There is no solution in those links to execute and not replace the current script. Or execute and not waitJim– Jim2017-08-18 14:17:47 +00:00Commented 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?Cubis– Cubis2017-08-18 16:08:50 +00:00Commented 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 scriptJim– Jim2017-08-18 18:16:07 +00:00Commented Aug 18, 2017 at 18:16
-
1if 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.Cubis– Cubis2017-08-18 18:55:03 +00:00Commented Aug 18, 2017 at 18:55
-
1What 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=1082332Cubis– Cubis2017-08-25 18:18:30 +00:00Commented Aug 25, 2017 at 18:18
|
Show 11 more comments