The software utility Cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration. Though its general-purpose nature makes it useful for things like downloading files from the Internet and downloading email at regular intervals.


Long-running PHP scripts are prone to failure, and need ways to automatically recover from being killed or hangs. The best way to achieve OP's goal is to use one cron job to poll a script every 1, 5, or however many minutes. That script should check a file (or db value) for a date + time. If the date + time is ≤ the current time, it should look through the full queue of tasks and do any that are ready. That date + time value should be updated with the next soonest from the queue whenever tasks are added/removed/finished. This is more efficient than searching the full queue every time.

Creating a daemon

The principles involved in creating a Cron Job are beyond the purview of this documentation. We note for the record that you will need access to the ability to create a Cron job and that the command line will anticipate that the script that you wish to run will be within your hosting areas and relies on the ability to run a PHP script from the Command Line Interface (CLI)


php -q /home/username/public_html/script.php

Scheduling a Task on a Windows Server with IIS

Similarly, the principles in setting up a Windows Task are also beyond the purview of this documentation. The CLI script will be located in a Batch File.

Created with the Personal Edition of HelpNDoc: Single source CHM, PDF, DOC and HTML Help creation