Following is the snippet of anonymous code which will help you to schedule your apex for any interval. The Time parameter is not well structured and because of it I had to put in efforts in compiling the time parameter.
Update (@23 Nov 2011) – Use below code to schedule apex class 10mins (change it as per your need) from now
String str = system.now().addMinutes(10).format(‘ss mm HH dd MM ? yyyy’);
System.schedule(‘Registration Report’, str , new scheduledApexClassName());
I am documenting all the parameters neatly, which will help you to schedule apex to run at any time interval even minutes. Below code executes Apex every 10 minutes.
scheduledApexClassName m = new scheduledApexClassName();
String seconds = ‘0’; //Execute at Zero Seconds
String minutes = ‘10,20,30,40,50’; //Execute at every 10th minute of hour
String hours = ‘*’; // Execute Every Hour
String dayOfMonth = ‘*’; // Execute Every Day of the Month
String month = ’11’; //Execute only in November(11)
String dayOfWeek = ‘?’; //Execute on all 7 days of the Week
String year = ‘2009’; //Execute only for year 2009
//Seconds Minutes Hours Day_of_month Month Day_of_week optional_year
String sch = seconds + ‘ ‘ + minutes + ‘ ‘ + hours + ‘ ‘ + dayOfMonth + ‘ ‘ + month + ‘ ‘ + dayOfWeek + ‘ ‘ + year;
//String sch = ‘0 10,20,30,40,50 * * 11 ? 2009’;
system.schedule(‘Registration Report’, sch, m);
Execute above code in system log i.e., execute above annonymous code and it will schedule your Apex Class.
For More Information on how to define a Schedule Apex Class refer http://na1.salesforce.com/help/doc/en/salesforce_winter10_release_notes.pdf#rn_162_apex_scheduler