Sometimes it is necessary to execute a command in an endless loop on Linux servers.
For example, in our case, we needed to execute the PHP script jobs.php continuously until we pressed Ctrl+C.
Here is how we accomplished this with a single command. This method also works on Mac computers and in the Cygwin shell on Windows:
while true; do php jobs.php; done
Press Ctrl+C to stop the loop at any time.
This approach can be used for any command that you need to keep running repeatedly, not just PHP scripts.