i have a batch(backup.bat)file.in that i have written a command to create a backup of database
which is
<
set path=%path%;C:\Program files\MySQL\MySQL Server 5.1\bin;
mysqldump -u `root` -padmin -B jewellery > backup\jewellery.sql
exit
>
i have created a controller to call this batch file.
that is given below
<
public class JobScheduleController extends QuartzJobBean {
protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException {
// check FTP
try {
Runtime rt = Runtime.getRuntime();
rt.exec("cmd.exe /c start Backup.bat");
.....
.....
......
catch(Exception ex){
ex.printStackTrace();
}
}
}
>
even i have given the mapping in bean.xml that is given below
!– Start Job Schedule for Application Backup Controllers–>
<bean name="jobScheduleController" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.jewellery.web.JobScheduleController" />
</bean>
<bean id="cronjobScheduleController" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="jobScheduleController" />
<!-- run at 11 am (0 0 11 ? * *") (Seconds,Minutes,Hours,Day-of-Month,Month,Day-of-Week) -->
<property name="cronExpression" value="0 0 11 ? * *" />
</bean>
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="cronjobScheduleController" />
</list>
</property>
</bean>
the problem is as per the given time the controller shuld search and invoke the batch file to execute.but it says the batch file not found.
where shuld i place the batch file .
the same code was running succussfully in spring 2.0,nw i have migrated to spring 3.
where shuld i place my batch file.?
i am using eclipse indigo…?and one more thing is this the best way to do it or some other way is also there..if there kindly let me knw.
Just set
Backup.batin your environmentpathvariable