A
A
anboo2016-02-09 11:34:09
PHP
anboo, 2016-02-09 11:34:09

How to properly start a socket server?

My socket server is written in PHP.
VPS on Ubuntu.
Here I am wondering how to start the socket server correctly so that it restarts if it crashes and starts when the system is restarted, etc.
My option:
Do I need to write some bash script that will run the command and, if the command ends, will start itself again?
And put @reboot /home/me/myscript.sh in the crown?
I even had the idea to run exec and with nohup run a socket server in the background from each user request at the level of the application itself, if it is already running, it will not do anything, but this is a very vivid example of hyper-perversions...
I understand that PHP is not for daemons, but I use a ready-made bundle - https://github.com/GeniusesOfSymfony/WebSocketBundle

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Ovchinnikov, 2016-02-09
@ova777

I suggest installing supervisord .
Monitors processes, as soon as a process crashes, it restarts!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question