I am trying to start program in background from command line:
[root@my]# php file.php&
[1] 16897
[root@my]# bg
[1]+ Stopped file.php
It always stopped doesn’t matter which php to start, where the problem is?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try with nohup
works fine for me (on kubuntu).
Note : standard output :
the standard output is redirected to
nohup.out(if it has not already been redirected);nohup.outis located in the folder from where you run the command in command line .So be carful to handle output properly, otherwise you might end up with a very big file after a couple of days/months
Note 2 : to stop the process :
The final & which backgrounds the process will print the PID. To kill the nohup process, run :
(with {PID} being the PID printed after you executed the ”
nohup php -r 'while (true) { echo "a";}' &” command).You could alternatively use
kill -9 {PID}if you need to force kill.