Cabbar Duzayak wrote:
Hi all, I have a requirement for initiating tasks from my site that requires long processing times, i.e. uploading/downloading some files to remote nodes. And, to avoid timeouts and hence to be able to provide instant responses to the user (user does not need to get the result right away), I was thinking about handling this with cronjobs, i.e. when I get this request, I will insert an entry into the crontab with exact time information (which is like 2 minutes from current time) and return the response to the user right away, and the task will be invoked right away (again 2 minutes from that time) by the cron daemon... Do you think this is a viable approach? Can you guys recommend a better way of handling this?
If it was me, I'd put the tasks that need running into a database table, and have a single cronjob that is always run every 5 minutes (or whatever is appropriate for your application) and which executes all jobs in the table and removes them when complete.
That way you don't need to dynamically alter your crontab. Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php