Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java Task / Cron environment

Reply
Thread Tools

Java Task / Cron environment

 
 
Horst Walter
Guest
Posts: n/a
 
      03-02-2004
I have to solve the following issues:

- I need to run Java programs at a certain time (cron-like).
- It's sometimes one program, sometimes multiple in parallel.
- These programs should each run in an individual JVM.
- After one program I might have to trigger other programs based on
the outcome.
- All these prg. are basically Java command line prgs.

Is there a free Java tool which I can use for this.
- Preferable if I can control this with RMI and / or a web interface
- It has be to "free"

Has somebody an idea or already solved a similar job.
Even if there is no "ready to use" prg around, maybe somebody has some
ideas what could be used as basis.

Thx
HW
 
Reply With Quote
 
 
 
 
Manavendra Gupta
Guest
Posts: n/a
 
      03-02-2004
> - I need to run Java programs at a certain time (cron-like).
+ create a cron script, specifying the times and full path names of the
java class tasks that you want to run.
> - It's sometimes one program, sometimes multiple in parallel.

+ specify as many tasks as you want. for parallel tasks, specify same
times (or keep them into a batch file and give that to cron).
> - These programs should each run in an individual JVM.

+ no problem. ensure you specify the full path name to JVM and the java
class - a new process+environment will be created for each.
> - After one program I might have to trigger other programs based on
> the outcome.

+ Use pipes ( | ) to pipe the output of one to the input of other.
> - All these prg. are basically Java command line prgs.


Dont know if there is such a program available, but if you are unix, then
cron can be used IMO


 
Reply With Quote
 
 
 
 
Horst Walter
Guest
Posts: n/a
 
      03-03-2004
Thanks for the answer. Yes I could do this with CRON / Linux commands.
But for me this is not the right approach - for several reasons:

One is - I did not mention this before - I have to run this on
Win/Linux/Sun. Second is, I am looking for a litte more sophisticated
solution. I am aware, there is nothing wrong about shell programming.
Everything can be done, there are even solutions which are platform
independent (e.g. Perl).

But my intention is to do it in Java, especially with the background
I'd like to incorporate this in our J2EE Web environment.

Best regards
KB



"Manavendra Gupta" <(E-Mail Removed)> wrote in message news:<4044c5d3$0$19226$(E-Mail Removed) .net>...
> > - I need to run Java programs at a certain time (cron-like).

> + create a cron script, specifying the times and full path names of the
> java class tasks that you want to run.
> > - It's sometimes one program, sometimes multiple in parallel.

> + specify as many tasks as you want. for parallel tasks, specify same
> times (or keep them into a batch file and give that to cron).
> > - These programs should each run in an individual JVM.

> + no problem. ensure you specify the full path name to JVM and the java
> class - a new process+environment will be created for each.
> > - After one program I might have to trigger other programs based on
> > the outcome.

> + Use pipes ( | ) to pipe the output of one to the input of other.
> > - All these prg. are basically Java command line prgs.

>
> Dont know if there is such a program available, but if you are unix, then
> cron can be used IMO

 
Reply With Quote
 
Gordon Beaton
Guest
Posts: n/a
 
      03-03-2004
On 3 Mar 2004 00:51:45 -0800, Horst Walter wrote:
> Thanks for the answer. Yes I could do this with CRON / Linux
> commands. But for me this is not the right approach - for several
> reasons:
>
> One is - I did not mention this before - I have to run this on
> Win/Linux/Sun. Second is, I am looking for a litte more
> sophisticated solution. I am aware, there is nothing wrong about
> shell programming. Everything can be done, there are even solutions
> which are platform independent (e.g. Perl).
>
> But my intention is to do it in Java, especially with the background
> I'd like to incorporate this in our J2EE Web environment.


He's not suggesting that you abandon Java in favour of shell
scripting. He is suggesting that you use cron to *schedule* your Java
programs.

Cron is part of every Linux as well as "Sun" (do you mean Solaris? I
run Linux on my Suns), and I am certain that there is a native windows
equivalent or at least a windows version of cron.

There is no need to reinvent the wheel.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
Manavendra Gupta
Guest
Posts: n/a
 
      03-03-2004

"Horst Walter" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Thanks for the answer.

No worries
>Yes I could do this with CRON / Linux commands.
> But for me this is not the right approach - for several reasons:
>
> One is - I did not mention this before - I have to run this on
> Win/Linux/Sun. Second is, I am looking for a litte more sophisticated
> solution. I am aware, there is nothing wrong about shell programming.
> Everything can be done, there are even solutions which are platform
> independent (e.g. Perl).

IMO, for what you wish to do, should best be a combination of probably
OS-specific stuff (cron on windows and the similar MSTask (?) for Win,etc)
or platform independent (Perl, as you said) and java. The core process
should be in your java classes, which shall be invoked by a crontab script.

> But my intention is to do it in Java, especially with the background
> I'd like to incorporate this in our J2EE Web environment.


Ahh, now we are talking. Take a look at the TimerService, which allows you
to schedule a timed notification to occur at a specific time, after a
duration of time, or at timed intervals. When the timer goes off, the EJB
Container calls the timeout() method (i'm not sure if thats the correct
name, you'd have to lookup), which should contain the business logic. So,
following is what you'd need to do the J2EE way:

1. Create a DB model where you storer your timers, events and associated
process. This should also store the where the output of each process should
go and at least some description of each process
2. A TimerService that understand this DB model and forks each process on a
specific timeout, as modeled
3. A web interface to your database for your CRUD operations

HTH
Manav


 
Reply With Quote
 
Horst Walter
Guest
Posts: n/a
 
      03-03-2004
Thanks to all who have responded so far. I wanted to add one thing: I
found something which is commercial but looks like the lib I am
searching for.

http://www.simscomputing.com/products/flux/features.jsp

Unfortunately I can not deploy any new commercial libs in my
particular project. So I am looking for something free.

Regards
HW








http://www.velocityreviews.com/forums/(E-Mail Removed) (Horst Walter) wrote in message news:<(E-Mail Removed). com>...
> Thanks for the answer. Yes I could do this with CRON / Linux commands.
> But for me this is not the right approach - for several reasons:
>
> One is - I did not mention this before - I have to run this on
> Win/Linux/Sun. Second is, I am looking for a litte more sophisticated
> solution. I am aware, there is nothing wrong about shell programming.
> Everything can be done, there are even solutions which are platform
> independent (e.g. Perl).
>
> But my intention is to do it in Java, especially with the background
> I'd like to incorporate this in our J2EE Web environment.
>
> Best regards
> KB
>
>
>
> "Manavendra Gupta" <(E-Mail Removed)> wrote in message news:<4044c5d3$0$19226$(E-Mail Removed) .net>...
> > > - I need to run Java programs at a certain time (cron-like).

> > + create a cron script, specifying the times and full path names of the
> > java class tasks that you want to run.
> > > - It's sometimes one program, sometimes multiple in parallel.

> > + specify as many tasks as you want. for parallel tasks, specify same
> > times (or keep them into a batch file and give that to cron).
> > > - These programs should each run in an individual JVM.

> > + no problem. ensure you specify the full path name to JVM and the java
> > class - a new process+environment will be created for each.
> > > - After one program I might have to trigger other programs based on
> > > the outcome.

> + Use pipes ( | ) to pipe the output of one to the input of other.
> > > - All these prg. are basically Java command line prgs.

> >
> > Dont know if there is such a program available, but if you are unix, then
> > cron can be used IMO

 
Reply With Quote
 
news.neti.ee
Guest
Posts: n/a
 
      03-03-2004

> On 3 Mar 2004 00:51:45 -0800, Horst Walter wrote:
>
>>Thanks for the answer. Yes I could do this with CRON / Linux
>>commands. But for me this is not the right approach - for several
>>reasons:
>>
>>One is - I did not mention this before - I have to run this on
>>Win/Linux/Sun. Second is, I am looking for a litte more
>>sophisticated solution. I am aware, there is nothing wrong about
>>shell programming. Everything can be done, there are even solutions
>>which are platform independent (e.g. Perl).
>>
>>But my intention is to do it in Java, especially with the background
>>I'd like to incorporate this in our J2EE Web environment.

>


check out Quartz:

"An enterprise-class job scheduler for integration with stand-alone java
applications and full-scale J2EE applications. Advanced features include
clustering and participation in container managed transactions."

http://sourceforge.net/projects/quartz
 
Reply With Quote
 
Horst Walter
Guest
Posts: n/a
 
      03-04-2004
Yes, this looks nice. Thanks.
Regards HW


"news.neti.ee" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> > On 3 Mar 2004 00:51:45 -0800, Horst Walter wrote:
> >
> >>Thanks for the answer. Yes I could do this with CRON / Linux
> >>commands. But for me this is not the right approach - for several
> >>reasons:
> >>
> >>One is - I did not mention this before - I have to run this on
> >>Win/Linux/Sun. Second is, I am looking for a litte more
> >>sophisticated solution. I am aware, there is nothing wrong about
> >>shell programming. Everything can be done, there are even solutions
> >>which are platform independent (e.g. Perl).
> >>
> >>But my intention is to do it in Java, especially with the background
> >>I'd like to incorporate this in our J2EE Web environment.

> >

>
> check out Quartz:
>
> "An enterprise-class job scheduler for integration with stand-alone java
> applications and full-scale J2EE applications. Advanced features include
> clustering and participation in container managed transactions."
>
> http://sourceforge.net/projects/quartz

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Python does not get environment variable when using cron. Shawn Milochik Python 1 08-19-2008 02:47 AM
Python does not get environment variable when using cron. Stephen Cattaneo Python 4 08-19-2008 02:36 AM
Re: Python does not get environment variable when using cron. Edwin.Madari@VerizonWireless.com Python 0 08-18-2008 12:27 PM
Re: Python does not get environment variable when using cron. Cameron Simpson Python 0 08-18-2008 05:11 AM
Linux cron : problem with a ruby task Zouplaz Ruby 3 09-14-2006 03:07 PM



Advertisments