I want to run a periodic task within a Grails application. Can anyone recommend a best practice for doing this?
My recommendation would be the Quartz Plugin, here's a summary of the plugin from the site:
Quartz plugin allows your Grails application to schedule jobs to be executed using a specified interval or cron expression. The underlying system uses the Quartz Enterprise Job Scheduler configured via Spring, but is made simpler by the coding by convention paradigm.
A simple way to do this based on the core JDK libraries is via the TimerTask, that should allow you to setup a recurring event:
http://java.sun.com/javase/6/docs/api/java/util/TimerTask.html
There's a good IBM article here on using it for this purpose:
http://www.ibm.com/developerworks/java/library/j-schedule.html
If you want something more complex in terms of control then look at Quartz or Enterprise Quartz.