Solved

How to auto schdedule to run jsp prgrams and make it excute once only (do not repeat even if we restart  the server)

Posted on 2007-03-21
34
472 Views
Last Modified: 2013-12-02
1) How to auto schdedule to run jsp prgrams with apache/tomcat server.
2) will the program be executed (eventhough for that day it has already run) if we stop and start the server
3) how to avoid it running again
0
Comment
Question by:Yap_YokeWan
  • 7
  • 7
  • 6
  • +4
34 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 18762631
Web apps run only when the receive a request from a client. What does it do?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18762633
If you only want it to serve one request, set a flag and only allow it to service one request
0
 

Author Comment

by:Yap_YokeWan
ID: 18762646
how do I do that... I need the program to run everyday at a fix time
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18762655
That's not how webapps work. They run when the client makes a request. As i asked - what does it do?
0
 
LVL 12

Accepted Solution

by:
keyurkarnik earned 100 total points
ID: 18762681
If you need your program to run only once, you should not make it a webapp.
You should make it a normal java program and have it run via a cron job in linux/unix
or as  a scheduled task in windows.

As it is a scheduled task, there is no point in making the program wait for an entire day then run once - its better to run it via a acheduled task
0
 
LVL 10

Assisted Solution

by:Jaax
Jaax earned 100 total points
ID: 18762734
Probably you have not chosen the right candidate to realise your requirements.
If you need to run a job at a specified time/periodically-
1.Use OS level schedulers like cron in Unix
2.For schedulers within JVM, you may consider the Quartz framework
0
 
LVL 12

Expert Comment

by:keyurkarnik
ID: 18762738
Jaax,
Please read previous comments so that you do not repeat them :)
0
 
LVL 92

Assisted Solution

by:objects
objects earned 100 total points
ID: 18763120
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18763177
If your server is a WIndows box you can use Task Scheduler
0
 
LVL 10

Expert Comment

by:Jaax
ID: 18763204
keyurkarnik: When I began writing, I didn't find yours :) But once I submitted mine was inserted after yours. You seemed to have posted in the meantime - which is out of my scope
0
 

Author Comment

by:Yap_YokeWan
ID: 18768611
can window scheduler  trigger java program since there is suggestion to do this way. How to do this?
0
 
LVL 92

Expert Comment

by:objects
ID: 18768662
yes, just specify the command you want executed.
0
 

Author Comment

by:Yap_YokeWan
ID: 18768988
where can I find some sample - on areas such as to  specify the application,  the location of program,  and the method to trigger
0
 
LVL 92

Expert Comment

by:objects
ID: 18769003
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Yap_YokeWan
ID: 18769268
thanks for the given link... is there any example how to schedule the task which require it to trigger java method which is using apache/tomcat with windows os
0
 
LVL 92

Expert Comment

by:objects
ID: 18769277
if u want to trigger something running inside a webapp then use quartz
0
 
LVL 12

Expert Comment

by:keyurkarnik
ID: 18769633
Could you explain the exact scenario where you need to use this. Cos if you need it to run only once and is not based on any client requests, you should NOT need to use  Tomcat or any webcontainers as such.
0
 

Author Comment

by:Yap_YokeWan
ID: 18769727
I have to run the program  at a particular time "EVERYDAY". what is the best solution to this? If I dont make the system to do this, then i have to run this manually daily.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 100 total points
ID: 18769729
Run a batch file that starts the app with Windows Task Scheduler
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 18772788
If it is also just a Windows based scheduling, you also don't need to use Java for it. You can use any of VB, C++, C# & family.

BTW are you also using Tomcat for something else? You've still not completely answered: >> if u want to trigger something running inside a webapp, and >> Could you explain the exact scenario where you need to use this.
0
 

Author Comment

by:Yap_YokeWan
ID: 18776345
I have created the  program wirttten in jsp/java as all my application is using these language. some of those programs are run currently by clicking a button from the webpage and then it will run in order for some process to be executed. I would want this process to be schedule so that no clicking is require from the web page  
0
 
LVL 92

Expert Comment

by:objects
ID: 18776391
use quartz :)
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 18776404
I would agree
0
 

Author Comment

by:Yap_YokeWan
ID: 18777490
is there any simple example on how I could use that to work. In this case, can window scheduler still work
0
 
LVL 30

Assisted Solution

by:mayankeagle
mayankeagle earned 100 total points
ID: 18777510
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18778297
>>it will run in order for some process to be executed.

Execute the process directly in the scheduler
0
 
LVL 92

Expert Comment

by:objects
ID: 19310899
How is CEHJ's comment not just repeating what has already been posted???
0
 
LVL 20

Expert Comment

by:Venabili
ID: 19310960
CEHJ has more than one comment. He gets points not just for the last one - because his first ones are worth also. And can you show me which comment says "Execute the process directly in the scheduler"?
0
 
LVL 92

Expert Comment

by:objects
ID: 19311025
eg.>  yes, just specify the command you want executed.
And it only takes 10 seconds to mention that you are repeating what has already been said ;)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now