A scheduled task in OpenMRS runs every so often and does tasks in the background.
Every task is run on a new thread.
Your class should extend AbstractTask
As of 1.7.0 tasks are executed as the Daemon User. This gives them all privileges without having to use Context.addProxyPrivilege().
Administering Scheduled Tasks