Discussion:
Browser Hangs while process run in background
(too old to reply)
praveenzx
2008-10-02 06:53:45 UTC
Permalink
i tried to run a command(background process), ie like `perl command
2>&1 > /dev/null &` ,

command will execute perl script and will run some Linux command like
lvcreate , dd_rescue and lvremove and some file write operations,

i thought that the command will run in background .
and so that i can load my browser with the message that its under
progress ,

but its not happening , my browser loads partially and waiting for the
process to get completed.

i don't want my browser to wait for that process to get completed ..

can any one advice me to solve this problem ,
Dave Turner
2008-10-02 15:11:19 UTC
Permalink
Post by praveenzx
i tried to run a command(background process), ie like `perl command
2>&1 > /dev/null &` ,
command will execute perl script and will run some Linux command like
lvcreate , dd_rescue and lvremove and some file write operations,
i thought that the command will run in background .
and so that i can load my browser with the message that its under
progress ,
but its not happening , my browser loads partially and waiting for the
process to get completed.
i don't want my browser to wait for that process to get completed ..
can any one advice me to solve this problem ,
Have you tried |++ toward the top of your program? It could be a
buffering problem, but that's only a guess.
Joe Smith
2008-10-04 10:31:10 UTC
Permalink
Post by praveenzx
i tried to run a command(background process), ie like `perl command
2>&1 > /dev/null &` ,
1) You've got 2>&1 in the wrong position to send STDERR to /dev/null.
2) You forgot about STDIN still being connected to the CGI program.
3) You're using qx`` instead of system().

system 'perl command </dev/null >/dev/null 2>&1 &';
or
system 'setsid perl command </dev/null >/dev/null 2>&1 &';


-Joe

Loading...