L
L
laboratory202017-11-28 15:04:00
PHP
laboratory20, 2017-11-28 15:04:00

How to run multiple php daemons at the same time?

Good afternoon. To perform certain tasks, I run php daemon scripts (with content like while(1) {.....}), go to Putty, execute the screen command, then php script.php and close Putty. There are 4 such scripts and sometimes you have to restart them all, doing the above procedure for each.
How to do it more correctly and how to automate the launch of several daemons?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Belyaev, 2017-12-22
@PavelBelyaev

You need to write a bash script, in it the process flies into the background and the process id is obtained, then it is written to the pid file, when stopping and restarting, the id is taken from the file, the process must also be unhooked from the current terminal, for this the disown command.
Google it, if you're interested - I can look at my scripts at home as I did.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question