I have a script that I can run successfully from the Linux command line.
This script runs in an infinite loop that opens and monitors a socket.
I have tried starting this script using a crop job, but then it stops after a few minutes.
I have also tried adding:
set_time_limit (0);
to the top of the code.
Essentially, I need this script to always be 'listening'.
PHP isn't well suited for long-running jobs, but the connection can also change its status without your control.
You have to be able to handle such changes - for example, recognising when a network connection has been dropped, and then re-open it.