will be helpful for those in need I think Celery is just for you. You can take a look at pereodic tasks for some background tasks. Also it's very easy to start using Celery with Django. You can start learning it here.
Hope this helps That's more or less what server software generally does. Usually it gets more complicated because the infinite loop "only" accepts the connection and each connection can often handle multiple "commands" (or whatever they are called in the used protocol), but the basic idea is roughly this.
Breaking infinite loop of a PHP script running in background [not killing the process]
I hope this helps . I have a PHP script which will run 24/7 on a VPS with an infinite loop, but problem is that how can I break the infinite loop in php script when desired in order so that the script exists properly? , Instead of:
Unable to run infinite loop process in background in terminal.