Is there any way I can set a cron to run for a certain amount of time before it disables itself?
I plan to use it to ensure a WordPress Backup to Dropbox completes on multiple websites. As WordPress hosting can be very flakey the backup may need to be re-started several times over a few hours to ensure that it completes.
It would be awesome if I could schedule a cron task to run every few minutes for certain amount of time. Then, once the cron time runs out having it automatically disable itself.
An API call to re-enable the cron would be needed too.
Yes, that will suffice.
So I will be able use the REST API to add a new cron task to, say, run from 1PM - 5PM Friday the 9th of May 2013?
Can I disable cron's via the API?
Comparing setting a certain amount to run the cron job, how do you think setting a period of time to run the cron job? These two features are both under consideration currently by us. But we don't want to implement both, because we want to keep the interface simple.
Regarding the API call, we have a REST API that can perform almost all actions you can do via the web interface. Check out more at our Cron Job API Document.
If you want to run the cron job every hour, you can set up a cron jobs with following cron expression:
0 13-17 9 5 *
These cron jobs will only run at 1PM - 5PM Thursday (9th, May is not Friday) the 9th of May 2013.
Of course they will be run next year, but you have much time to turn them off.
If you want to run the cron job every several minutes (e.g. x minutes) with the time period, you can set something like
*/x 13-17 9 5 *