Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sceduling a task for everyday at a particular time??

 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my web application on the server side i want to generate a txt file with some data from the database automatically EVERYDAY at a particular time(for e.g at 8 pm).So how can i do this??
 
Joe Ess
Bartender
Posts: 9339
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a Unix environment, use cron
In Windows, use task scheduler
 
Jignesh Gohel
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No no not that way joe.
Its a requirement in my web application.I have to generate a file using Java & that also at a particular time as previously i mentioned.So using the Java API how can i do it???
 
Amit K Srivastava
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this could address your concern. Try using Logger to log the data and use time based log rotation policy to generate log at specific interval.

--Amit Srivastava
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you web contaniner runs on JDK 1.4 then you can implement TimerTask and use Timer to schedule the TimerTask to run at specific time. Though you can't be sure if the task will run exactly at the specified time (there might be small delay). You can look at the Timer API for info.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jignesh Gohel:
No no not that way joe.
Its a requirement in my web application.I have to generate a file using Java & that also at a particular time as previously i mentioned.So using the Java API how can i do it???


I would do it Joe's way. Its the only reliable way. Create a seperate standalone java program. or just get cron to send a signal to your java program at a certain time with a script. Then your program can respond to that. I wouldn't want to create another task scheduling facility where there is already a tried and true one.
 
Marcus Pant
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we�ve used the quartz framework for java-based scheduling tasks. i guess it is a wrapper on TimerTask but is quite easy to configure.
http://www.opensymphony.com/quartz/
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mr. C Lamont Gilbert:
I would do it Joe's way.


Ditto.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic