Socket PHP lives falling [closed]

2

I wentogle and found ways to work with the socket. Then I started the service in my VPS. At first it was working ok. However, now, from moment to moment, the Socket drops, causing me to need to access ssh at any time to restart it.

Would you help me with this question, what should I do to resolve it?

    
asked by anonymous 10.07.2017 / 16:28

1 answer

0

There is a process control system that I use called SupervisorD .

It allows you to start a process. The same, if the process falls, try to start it again, according to what you configure.

You can install it on Linux like this:

sudo apt install supervisor

Then you need to start the service

sudo service supervisor start

After this, you can start using supervisor to manage your processes.

First, you need to create a configuration file of it in the /etc/supervisor/conf.d folder with the .conf extension.

For example nome-do-programa-ou-comando.conf :

[program:nome-do-programa]

autorestart=true
autostart=true
command=php /meu/script/php_socket.php
numprocs=1
process_name=socket
redirect_stderr=true
stdout_logfile=/tmp/projeto.log
user=wallace

Then you can use the sudo supervisorclt update command. The file you've set up will probably be displayed.

When you do this, your process will start.

If you need to modify the file, you can do it normally, without stopping supervisor .

What you need to do is to run the sudo supervisorctl reread command to recognize the changes made, and then use the sudo supervisorclt update command to restart the process with the new changes.

While understanding the basics about SupervisorD, here in the company it was very helpful to make sure that the process responsible for running queues never dropped. I have rarely encountered problems using Supervisor.

    
01.11.2018 / 12:49