Fire and forget under OS/2

D

Dave Saville

Trying to start a process as "fire and forget" ie I want the process
to just go off by itself and the invoking script to keep going and not
kill the invoked process when it exits.

Google around and it looks as if "system 'foo &'" should work. But
under OS/2 ECS it does not - even though, from the command line, "sh
foo &" from a sh prompt works as in *nix.

As an aside, "system foo&" with a "ps" in another window shows an
instance of sh with foo as child.
system "sh -c foo &" with a "ps" in another window shows *three*
instances of sh and one of foo in a straight chain of pids. Can't
figure why three and not two.

TIA
 
D

Dave Saville

Trying to start a process as "fire and forget" ie I want the process
to just go off by itself and the invoking script to keep going and not
kill the invoked process when it exits.

Google around and it looks as if "system 'foo &'" should work. But
under OS/2 ECS it does not - even though, from the command line, "sh
foo &" from a sh prompt works as in *nix.

As an aside, "system foo&" with a "ps" in another window shows an
instance of sh with foo as child.
system "sh -c foo &" with a "ps" in another window shows *three*
instances of sh and one of foo in a straight chain of pids. Can't
figure why three and not two.

Turned out to be a shell problem. Perl looks for sh. It found one, but
at some point in the past I had aliased it to ksh. Aliased pdksh to sh
and it works perfectly. :)
 
D

Dave Saville

perldoc perlos2 points you to OS2::process, which suggests something like

use OS2::process;

system P_NOWAIT | P_UNRELATED, "foo";

may be what you want. I don't know what the difference is between the
various constants you can use for that first argument; presumably this
is explained in the OS/2 system documentation.

Hi Ben

Yes they are the same parms as some C functions use for starting
things. However, last night I had a brainwave as to why "system foo &"
did not work which google suggests should. Turns out that at some time
in the dim past I had copied ksh to sh. Having tried all the OS/2
shells I have knocking around pdksh works as one would expect on *nix.
Happy bunny.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top