D
D
DrunkMaster2015-09-07 16:53:47
PHP
DrunkMaster, 2015-09-07 16:53:47

How to keep the script running after closing the console?

In the console, I enter the command , the php script.phpscript starts working, if I close the console or the connection to the network is lost, the script stops.
How to make it work further even if the console is closed? Tried php script.php &it didn't work...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor, 2015-09-07
@merryjane

nohup php script.php &
Read also about
screen
tmux
disown

S
Saboteur, 2015-09-07
@saboteur_kiev

use nohup <your command>
in fact, when the connection is broken, the hup signal is sent to the process (historically, the type picked up the phone, the modem ended).
the nohup program blocks this signal, and in the event of a connection break, it redirects all output that should have gone to the screen (stdout) to the nohup.out file (by default, in the same directory where the script was run)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question