I have a php script of server working with sockets (in order to create a chat).
I want the script to run in the background (it have infinity loop), so I'm using this command:
php -q server.php &
In order to run the server.
It's works OK!
But I have two problems:
- I want to know if the script is stop running for some reason (via email notice)
- If it stop running, make it run again automatically (also if the server was restarted - the script should start run automatically
How can I achieve this two things?