aspose file tools*
The moose likes Java in General and the fly likes Sceduling a task for everyday at a particular time?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Sceduling a task for everyday at a particular time??" Watch "Sceduling a task for everyday at a particular time??" New topic
Author

Sceduling a task for everyday at a particular time??

Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
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??


Regards,
Jignesh

The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8903
    
    8

In a Unix environment, use cron
In Windows, use task scheduler


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
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

Joined: May 16, 2006
Posts: 23
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

Joined: May 24, 2003
Posts: 425
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

Joined: Oct 05, 2001
Posts: 1170

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

Joined: May 21, 2004
Posts: 7
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

Joined: Jan 10, 2002
Posts: 61201
    
  66

Originally posted by Mr. C Lamont Gilbert:
I would do it Joe's way.


Ditto.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sceduling a task for everyday at a particular time??