1

How can I execute shell command in background using & at the end? I've try:

php -r "shell_exec('sleep 10 &');"

and

php -r "shell_exec('/bin/bash -c \"sleep 10 &\"');"

in both cases it pause for 10 seconds instead of just give the shell back and run sleep in background.

1 Answer 1

3

You have to reroute the output somewhere. Try something like this:

php -r "shell_exec('sleep 10 > /dev/null &');"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.