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
Yap_YokeWanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JaaxArchitectCommented:
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
JaaxArchitectCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java App Servers

From novice to tech pro — start learning today.