skip to main | skip to sidebar

Java Programs and Examples with Output

Pages

▼
 
  • RSS
  • Twitter
Saturday, October 6, 2012

Scheduler to run an exe at regular interval

Posted by Raju Gupta at 12:27 AM – 0 comments
 
This tool helps you to run a job repetitively at a regular interval. This will be useful when your job can be executed through command prompt

Sceduler.bat :

:start
start %2%
java Sleeper %1%
goto start


=================================================
Sleeper.java


class Sleeper{

 public static void main(String[] args){
  int sleepTime = Integer.parseInt(args[0]);
  try{
   Thread.sleep(sleepTime*60*1000);
  }catch(InterruptedException ex){
   ex.printStackTrace();
  }
 }
}

=====================================================
Execution:
cmd>  scheduler.bat  'time interval in minutes'  'exe name'

example:
cmd> sceduler.bat 5 notepad.exe

Leave a Reply

Newer Post Older Post
Subscribe to: Post Comments ( Atom )
  • Popular
  • Recent
  • Archives
Powered by Blogger.
 
 
 
© 2011 Java Programs and Examples with Output | Designs by Web2feel & Fab Themes

Bloggerized by DheTemplate.com - Main Blogger