Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 1.31 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. quartz scheduling in spring 3 with batch file
  2. <
  3. set path=%path%;C:Program filesMySQLMySQL Server 5.1bin;
  4. mysqldump -u `root` -padmin -B jewellery > backupjewellery.sql
  5. exit
  6. >
  7.        
  8. <
  9. public class JobScheduleController extends QuartzJobBean {
  10.       protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException {
  11.           // check FTP
  12.           try {
  13.                 Runtime rt = Runtime.getRuntime();
  14.                 rt.exec("cmd.exe /c start Backup.bat");
  15. .....
  16. .....
  17. ......
  18. catch(Exception ex){
  19.                 ex.printStackTrace();
  20.                 }
  21.       }
  22. }
  23. >
  24.        
  25. <bean name="jobScheduleController" class="org.springframework.scheduling.quartz.JobDetailBean">
  26.   <property name="jobClass" value="com.jewellery.web.JobScheduleController" />
  27. </bean>
  28.  
  29. <bean id="cronjobScheduleController" class="org.springframework.scheduling.quartz.CronTriggerBean">
  30.     <property name="jobDetail" ref="jobScheduleController" />
  31.     <!-- run at 11 am (0  0  11  ?  *  *") (Seconds,Minutes,Hours,Day-of-Month,Month,Day-of-Week) -->
  32.     <property name="cronExpression" value="0 0 11 ? * *" />
  33. </bean>
  34.  
  35. <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
  36.     <property name="triggers">
  37.         <list>
  38.             <ref bean="cronjobScheduleController" />
  39.             </list>
  40.     </property>
  41. </bean>