Swoole Auto Restart
Total Size: 1.57 KB
Created: 2 years ago
Edited: 2 years ago
In the example on the right, the command we want to run is './Swoole_HTTP_Server.sh' or whatever you call the shell script... Make sure you get the path to your PHP file correct or it will not work.
$DIR is just the directory containing this script file (computed automatically, but you can hardcode it if you want).
Use $DIR to specify paths relative to the script's path.The PROCESS_NAME variable is the name of the process to kill and restartYou must ensure your process has the same name each time it runs (we use a file at $DIR/servername to store the name)
Alternatively, you can hard code the PROCESS_NAME on line if you like
sudo apt-get install inotify-tools
So now when you want to run your Swoole HTTP server you run this script and upon every change, the server will restart.
Are you sure you want to delete?