I need to perform a time-consuming task when the user clicks a button. Basically, I'll be doing some processing on every post, sending requests to a remote server for many.
The user won't need the result immediately, so I can run it in the background. But I need to be able to tell the user whether the task has finished yet or not (and the result if finished) when they visit that page again. Additionally, I don't want them to be able to start another instance of the same task (by clicking the button) while the first one is still running.
Any way I can do all of the above?
EDIT: I am developing for WordPress. It was tagged, but I think I should have mentioned it in the question.