On one of the projects on Yii2 I use sockets. The socket server is started by the command

php yii socket/start-socket 

I run it by adding & at the end that it would work in the background. But time passes, and he is cut down and I cannot understand why.

Is it possible to create some kind of script that will check the server and, in the event of a crash, restart it?

    1 answer 1

    You need the supervisor to monitor the process and, in the event of a crash, start the process again. I would recommend:

    1. supervisord (for unix systems)
    2. pm2 (suitable also for Windows)
    • thanks It works. but for some reason when the process hangs for a long time - it does not work - Diefair