Java Task / Cron environment

Discussion in 'Java' started by Horst Walter, Mar 2, 2004.

  1. Horst Walter

    Horst Walter Guest

    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
     
    Horst Walter, Mar 2, 2004
    #1
    1. Advertising

  2. > - 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
     
    Manavendra Gupta, Mar 2, 2004
    #2
    1. Advertising

  3. Horst Walter

    Horst Walter Guest

    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" <> wrote in message news:<4044c5d3$0$19226$>...
    > > - 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
     
    Horst Walter, Mar 3, 2004
    #3
  4. 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
     
    Gordon Beaton, Mar 3, 2004
    #4
  5. "Horst Walter" <> wrote in message
    news:...
    > 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
     
    Manavendra Gupta, Mar 3, 2004
    #5
  6. Horst Walter

    Horst Walter Guest

    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








    (Horst Walter) wrote in message news:<>...
    > 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" <> wrote in message news:<4044c5d3$0$19226$>...
    > > > - 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
     
    Horst Walter, Mar 3, 2004
    #6
  7. Horst Walter

    news.neti.ee Guest


    > 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
     
    news.neti.ee, Mar 3, 2004
    #7
  8. Horst Walter

    Horst Walter Guest

    Yes, this looks nice. Thanks.
    Regards HW


    "news.neti.ee" <> wrote in message news:<>...
    > > 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
     
    Horst Walter, Mar 4, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen Cattaneo
    Replies:
    4
    Views:
    507
    Asun Friere
    Aug 19, 2008
  2. Cameron Simpson
    Replies:
    0
    Views:
    696
    Cameron Simpson
    Aug 18, 2008
  3. Replies:
    0
    Views:
    464
  4. Shawn Milochik
    Replies:
    1
    Views:
    365
    Asun Friere
    Aug 19, 2008
  5. Zouplaz
    Replies:
    3
    Views:
    146
    William Crawford
    Sep 14, 2006
Loading...

Share This Page