I have developed a module to synchronize certain data from some internal software to our Magento installation. This task typically takes a few minutes and must be initiated by the user on an as-needed basis i.e., scheduling it as a recurring job via configuration is not an option.
My first consideration which I think would be the quickest and easiest approach would be to "fake it" using sockets. That is to say, I have one controller action which is invoked via AJAX request which simply opens/closes a socket (i.e., does not wait for a response) to a another controller action which actually performs the task. The first controller action could respond back with a message like "The job has been queued". There are no important results of the long running task, but I could easily log them somewhere to be later viewed if need be.
While I think the socket approach would work just fine, given that Magento has a cron implementation it makes sense to leverage that, but I can't seem to figure out a way to schedule a job in the cron_schedule
table programatically i.e., without some XML configuration.
So that leads me to the question: is there a way to "manually" schedule a task in Magento's cron system without it a) reoccurring or b) requiring the use of XML configuration? Or would I be best off implementing my own cron.php
approach for my own jobs like this one?