In this example you can see a ready to use template for create Schedulers.
We have included a Scheduler example that looks for opportunities without modifications within certain period of time. In case we got unmodified opportunities the script sends an email to the assigned user to alert for possible forgotten opportunities.
Just zip the php files and install as any other module in your SugarCRM instance.