Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

exec() and &

Question posted by: Bryan Andrews (Guest) on March 15th, 2008 01:55 AM
At the shell you can always type "rm -rf /tmp/* &" and let the delete
command run in the background. Is there a way to do this from a php
shell script?

I've tried `rm -rf /tmp/* &` ... but with the backticks it still
waits for the command to finish before moving on to the next. I've
also tried exec() with no luck. Anyone know any tricks?
Steve's Avatar
Steve
Guest
n/a Posts
March 15th, 2008
02:35 AM
#2

Re: exec() and &
On Mar 14, 9:54 pm, Bryan Andrews <bryanandr...@gmail.comwrote:
Quote:
At the shell you can always type "rm -rf /tmp/* &" and let the delete
command run in the background. Is there a way to do this from a php
shell script?
>
I've tried `rm -rf /tmp/* &` ... but with the backticks it still
waits for the command to finish before moving on to the next. I've
also tried exec() with no luck. Anyone know any tricks?


http://us.php.net/manual/en/function.pcntl-fork.php

It's not really threading, but you can escape the parent process while
the child is running.

Bryan Andrews's Avatar
Bryan Andrews
Guest
n/a Posts
March 15th, 2008
07:45 PM
#3

Re: exec() and &
On Mar 14, 7:33 pm, Steve <steve.h...@gmail.comwrote:
Quote:
On Mar 14, 9:54 pm, Bryan Andrews <bryanandr...@gmail.comwrote:
>
Quote:
At the shell you can always type "rm -rf /tmp/* &" and let the delete
command run in the background. Is there a way to do this from a php
shell script?

>
Quote:
I've tried `rm -rf /tmp/* &` ... but with the backticks it still
waits for the command to finish before moving on to the next. I've
also tried exec() with no luck. Anyone know any tricks?

>
http://us.php.net/manual/en/function.pcntl-fork.php
>
It's not really threading, but you can escape the parent process while
the child is running.


That worked great, thanks!

good@respnse.sic.com's Avatar
good@respnse.sic.com
Guest
n/a Posts
March 17th, 2008
05:45 PM
#4

Re: exec() and &
In article <1b3a9e06-a84d-4a95-a22a-
Join Bytes!>, Join Bytes!
says...
Quote:
Quote:
http://us.php.net/manual/en/function.pcntl-fork.php

It's not really threading, but you can escape the parent process while
the child is running.

>
That worked great, thanks!
>


Seconded - very interesting reading - thank you.

 
Not the answer you were looking for? Post your question . . .
189,165 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors