• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

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

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
Yap_YokeWan
Asked:
Yap_YokeWan
  • 7
  • 7
  • 6
  • +4
5 Solutions
 
CEHJCommented:
Web apps run only when the receive a request from a client. What does it do?
0
 
CEHJCommented:
If you only want it to serve one request, set a flag and only allow it to service one request
0
 
Yap_YokeWanAuthor Commented:
how do I do that... I need the program to run everyday at a fix time
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
CEHJCommented:
That's not how webapps work. They run when the client makes a request. As i asked - what does it do?
0
 
keyurkarnikCommented:
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
 
JaaxCommented:
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
 
keyurkarnikCommented:
Jaax,
Please read previous comments so that you do not repeat them :)
0
 
objectsCommented:
0
 
CEHJCommented:
If your server is a WIndows box you can use Task Scheduler
0
 
JaaxCommented:
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
 
Yap_YokeWanAuthor Commented:
can window scheduler  trigger java program since there is suggestion to do this way. How to do this?
0
 
objectsCommented:
yes, just specify the command you want executed.
0
 
Yap_YokeWanAuthor Commented:
where can I find some sample - on areas such as to  specify the application,  the location of program,  and the method to trigger
0
 
Yap_YokeWanAuthor Commented:
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
 
objectsCommented:
if u want to trigger something running inside a webapp then use quartz
0
 
keyurkarnikCommented:
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
 
Yap_YokeWanAuthor Commented:
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
 
CEHJCommented:
Run a batch file that starts the app with Windows Task Scheduler
0
 
Mayank SAssociate Director - Product EngineeringCommented:
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
 
Yap_YokeWanAuthor Commented:
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
 
objectsCommented:
use quartz :)
0
 
Mayank SAssociate Director - Product EngineeringCommented:
I would agree
0
 
Yap_YokeWanAuthor Commented:
is there any simple example on how I could use that to work. In this case, can window scheduler still work
0
 
Mayank SAssociate Director - Product EngineeringCommented:
0
 
CEHJCommented:
>>it will run in order for some process to be executed.

Execute the process directly in the scheduler
0
 
objectsCommented:
How is CEHJ's comment not just repeating what has already been posted???
0
 
VenabiliCommented:
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
 
objectsCommented:
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

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 7
  • 7
  • 6
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now