Re: Running system() commands in background

From: Trent Curry (tcurrey_at_no.no.i.said.no)
Date: 10/28/03


Date: Mon, 27 Oct 2003 18:05:34 -0800

qazmlp wrote:
> Whenever system("command") is called in a perl script, a new
> (commandline) window opens and shows the execution of the "command".
> What do I need to do if
> I have to run the command in the background? Basically, I do not
> prefer the user to see what is happening when the perl script is being
> executed.
>
> The test was done in Win2K & the solution is required in the same.
>
> Thanks!

Anyone know if this works in windows (it does under unix/linux):

<code type=perl;handtyped>
#!/usr/bin/perl -w

use strict;

exit if fork;

system("command");
</code>

I'm not sure fork will work under win32. Worth a try I suppose.

-- 
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1)!eg
;print(reverse("$s")."\n");'


Relevant Pages

  • Re: CGI script: release browser after spawning new process
    ... > filled form and pass them along as command line parameters to another ... > perl script that should run the computation in the background. ... You have to close STDOUT and STDERR, ... You need a fork to protect from this. ...
    (comp.lang.perl.misc)
  • Re: when does ssh return?
    ... can't seem to figure out how to use ssh to start a command on a remote ... and a similar thing with a perl script that forks. ... the perl script fork, have its child fork, and then the grandchild ...
    (SSH)
  • when does ssh return?
    ... I've looked through ssh man page and FAQ and tried a google search, but can't seem to figure out how to use ssh to start a command on a remote machine, have ssh exit immediately, and still have the command running on the remote machine. ... and a similar thing with a perl script that forks. ... the perl script fork, have its child fork, and then the grandchild ...
    (SSH)
  • RE: setting unix command through perl script
    ... setting unix command through perl script ... it changes the environment of the shell you ... If I run this command on bash prompt then it is executing properly but ...
    (perl.beginners)
  • RE: setting unix command through perl script
    ... I have run the command like this.... ... setting unix command through perl script ... shell you spawn with qx; but after this statement your shell ... To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx ...
    (perl.beginners)